diff --git a/play-services-location-api/build.gradle b/play-services-location-api/build.gradle deleted file mode 100644 index 7d1eb81f..00000000 --- a/play-services-location-api/build.gradle +++ /dev/null @@ -1,37 +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. - */ - -apply plugin: 'com.android.library' - -android { - compileSdkVersion androidCompileSdk - buildToolsVersion "$androidBuildVersionTools" - - defaultConfig { - versionName version - minSdkVersion androidMinSdk - targetSdkVersion androidTargetSdk - } - - compileOptions { - sourceCompatibility = 1.8 - targetCompatibility = 1.8 - } -} - -dependencies { - api project(':play-services-basement') -} diff --git a/play-services-location-api/gradle.properties b/play-services-location-api/gradle.properties deleted file mode 100644 index de0a3085..00000000 --- a/play-services-location-api/gradle.properties +++ /dev/null @@ -1,34 +0,0 @@ -# -# 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. -# - -POM_NAME=Play Services Internal Location API -POM_DESCRIPTION=Interfaces and objects for IPC between Play Services Library and Play Services Core - -POM_PACKAGING=aar - -POM_URL=https://github.com/microg/android_external_GmsApi - -POM_SCM_URL=https://github.com/microg/android_external_GmsApi -POM_SCM_CONNECTION=scm:git@github.com:microg/android_external_GmsApi.git -POM_SCM_DEV_CONNECTION=scm:git@github.com:microg/android_external_GmsApi.git - -POM_LICENCE_NAME=The Apache Software License, Version 2.0 -POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt -POM_LICENCE_DIST=repo - -POM_DEVELOPER_ID=mar-v-in -POM_DEVELOPER_NAME=Marvin W - diff --git a/play-services-location-api/src/main/AndroidManifest.xml b/play-services-location-api/src/main/AndroidManifest.xml deleted file mode 100644 index 4a97d616..00000000 --- a/play-services-location-api/src/main/AndroidManifest.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/ActivityRecognitionResult.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/ActivityRecognitionResult.aidl deleted file mode 100644 index 52b4c775..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/ActivityRecognitionResult.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location; - -parcelable ActivityRecognitionResult; \ No newline at end of file diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/GeofencingRequest.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/GeofencingRequest.aidl deleted file mode 100644 index d88a3ac8..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/GeofencingRequest.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location; - -parcelable GeofencingRequest; diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/GestureRequest.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/GestureRequest.aidl deleted file mode 100644 index 9fffa77a..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/GestureRequest.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location; - -parcelable GestureRequest; diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/ILocationCallback.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/ILocationCallback.aidl deleted file mode 100644 index bbccd355..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/ILocationCallback.aidl +++ /dev/null @@ -1,11 +0,0 @@ -package com.google.android.gms.location; - -import android.location.Location; - -import com.google.android.gms.location.LocationAvailability; -import com.google.android.gms.location.LocationResult; - -interface ILocationCallback { - void onLocationResult(in LocationResult result) = 0; - void onLocationAvailability(in LocationAvailability availability) = 1; -} diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/ILocationListener.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/ILocationListener.aidl deleted file mode 100644 index 323f9059..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/ILocationListener.aidl +++ /dev/null @@ -1,7 +0,0 @@ -package com.google.android.gms.location; - -import android.location.Location; - -interface ILocationListener { - void onLocationChanged(in Location location); -} diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationAvailability.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationAvailability.aidl deleted file mode 100644 index 8037232b..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationAvailability.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location; - -parcelable LocationAvailability; diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationRequest.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationRequest.aidl deleted file mode 100644 index 915aa2ae..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationRequest.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location; - -parcelable LocationRequest; diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationResult.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationResult.aidl deleted file mode 100644 index d79917b7..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationResult.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location; - -parcelable LocationResult; diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationSettingsRequest.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationSettingsRequest.aidl deleted file mode 100644 index 2552ed66..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationSettingsRequest.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location; - -parcelable LocationSettingsRequest; diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationSettingsResult.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationSettingsResult.aidl deleted file mode 100644 index 54dad656..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationSettingsResult.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location; - -parcelable LocationSettingsResult; diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationStatus.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationStatus.aidl deleted file mode 100644 index 398d9c18..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationStatus.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location; - -parcelable LocationStatus; diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/FusedLocationProviderResult.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/FusedLocationProviderResult.aidl deleted file mode 100644 index 37a17787..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/FusedLocationProviderResult.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location.internal; - -parcelable FusedLocationProviderResult; diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/IFusedLocationProviderCallback.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/IFusedLocationProviderCallback.aidl deleted file mode 100644 index c0560fe5..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/IFusedLocationProviderCallback.aidl +++ /dev/null @@ -1,7 +0,0 @@ -package com.google.android.gms.location.internal; - -import com.google.android.gms.location.internal.FusedLocationProviderResult; - -interface IFusedLocationProviderCallback { - void onFusedLocationProviderResult(in FusedLocationProviderResult result) = 0; -} diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/IGeofencerCallbacks.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/IGeofencerCallbacks.aidl deleted file mode 100644 index ac3950f5..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/IGeofencerCallbacks.aidl +++ /dev/null @@ -1,9 +0,0 @@ -package com.google.android.gms.location.internal; - -import android.app.PendingIntent; - -interface IGeofencerCallbacks { - void onAddGeofenceResult(int statusCode, in String[] requestIds) = 0; - void onRemoveGeofencesByRequestIdsResult(int statusCode, in String[] requestIds) = 1; - void onRemoveGeofencesByPendingIntentResult(int statusCode, in PendingIntent pendingIntent) = 2; -} diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/IGoogleLocationManagerService.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/IGoogleLocationManagerService.aidl deleted file mode 100644 index 8e78a899..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/IGoogleLocationManagerService.aidl +++ /dev/null @@ -1,88 +0,0 @@ -package com.google.android.gms.location.internal; - -import android.app.PendingIntent; -import android.location.Location; -import android.os.Bundle; - -import com.google.android.gms.common.api.Status; -import com.google.android.gms.location.places.AutocompleteFilter; -import com.google.android.gms.location.places.internal.IPlacesCallbacks; -import com.google.android.gms.location.internal.ISettingsCallbacks; -import com.google.android.gms.location.internal.LocationRequestInternal; -import com.google.android.gms.location.internal.LocationRequestUpdateData; -import com.google.android.gms.location.internal.ParcelableGeofence; -import com.google.android.gms.location.places.NearbyAlertRequest; -import com.google.android.gms.location.places.PlaceFilter; -import com.google.android.gms.location.places.PlaceRequest; -import com.google.android.gms.location.places.PlaceReport; -import com.google.android.gms.location.places.internal.PlacesParams; -import com.google.android.gms.location.places.UserAddedPlace; -import com.google.android.gms.location.places.UserDataType; -import com.google.android.gms.location.ActivityRecognitionResult; -import com.google.android.gms.location.GeofencingRequest; -import com.google.android.gms.location.GestureRequest; -import com.google.android.gms.location.LocationAvailability; -import com.google.android.gms.location.LocationRequest; -import com.google.android.gms.location.LocationSettingsRequest; -import com.google.android.gms.location.LocationStatus; -import com.google.android.gms.location.internal.IGeofencerCallbacks; -import com.google.android.gms.location.ILocationListener; -import com.google.android.gms.maps.model.LatLng; -import com.google.android.gms.maps.model.LatLngBounds; - -interface IGoogleLocationManagerService { - void addGeofencesList(in List geofences, in PendingIntent pendingIntent, IGeofencerCallbacks callbacks, String packageName) = 0; - void addGeofences(in GeofencingRequest geofencingRequest, in PendingIntent pendingIntent, IGeofencerCallbacks callbacks) = 56; - void removeGeofencesByIntent(in PendingIntent pendingIntent, IGeofencerCallbacks callbacks, String packageName) = 1; - void removeGeofencesById(in String[] geofenceRequestIds, IGeofencerCallbacks callbacks, String packageName) = 2; - void removeAllGeofences(IGeofencerCallbacks callbacks, String packageName) = 3; - - void requestActivityUpdates(long detectionIntervalMillis, boolean alwaysTrue, in PendingIntent callbackIntent) = 4; - void removeActivityUpdates(in PendingIntent callbackIntent) = 5; - ActivityRecognitionResult getLastActivity(String packageName) = 63; - Status iglms65(in PendingIntent pendingIntent) = 64; - Status iglms66(in PendingIntent pendingIntent) = 65; - - Status requestGestureUpdates(in GestureRequest request, in PendingIntent pendingIntent) = 59; - Status iglms61(in PendingIntent pendingIntent) = 60; - - Location getLastLocation() = 6; - void requestLocationUpdatesWithListener(in LocationRequest request, ILocationListener listener) = 7; - void requestLocationUpdatesWithPackage(in LocationRequest request, ILocationListener listener, String packageName) = 19; - void requestLocationUpdatesWithIntent(in LocationRequest request, in PendingIntent callbackIntent) = 8; - void requestLocationUpdatesInternalWithListener(in LocationRequestInternal request, ILocationListener listener) = 51; - void requestLocationUpdatesInternalWithIntent(in LocationRequestInternal request, in PendingIntent callbackIntent) = 52; - void removeLocationUpdatesWithListener(ILocationListener listener) = 9; - void removeLocationUpdatesWithIntent(in PendingIntent callbackIntent) = 10; - void updateLocationRequest(in LocationRequestUpdateData locationRequestUpdateData) = 58; - //void flushLocations(IFusedLocationProviderCallback callback = 66; - - void setMockMode(boolean mockMode) = 11; - void setMockLocation(in Location mockLocation) = 12; - - Location getLastLocationWithPackage(String packageName) = 20; - void iglms26(in Location var1, int var2) = 25; - LocationAvailability getLocationAvailabilityWithPackage(String packageName) = 33; - - IBinder iglms51() = 50; - void requestLocationSettingsDialog(in LocationSettingsRequest settingsRequest, ISettingsCallbacks callback, String packageName) = 62; - - void iglms14(in LatLngBounds var1, int var2, in PlaceFilter var3, in PlacesParams var4, IPlacesCallbacks var5) = 13; - void iglms15(String var1, in PlacesParams var2, IPlacesCallbacks var3) = 14; - void iglms16(in LatLng var1, in PlaceFilter var2, in PlacesParams var3, IPlacesCallbacks var4) = 15; - void iglms17(in PlaceFilter var1, in PlacesParams var2, IPlacesCallbacks var3) = 16; - void iglms18(in PlaceRequest var1, in PlacesParams var2, in PendingIntent var3) = 17; - void iglms19(in PlacesParams var1, in PendingIntent var2) = 18; - void iglms25(in PlaceReport var1, in PlacesParams var2) = 24; - void iglms42(String var1, in PlacesParams var2, IPlacesCallbacks var3) = 41; - void iglms46(in UserAddedPlace var1, in PlacesParams var2, IPlacesCallbacks var3) = 45; - void iglms47(in LatLngBounds var1, int var2, String var3, in PlaceFilter var4, in PlacesParams var5, IPlacesCallbacks var6) = 46; - void iglms48(in NearbyAlertRequest var1, in PlacesParams var2, in PendingIntent var3) = 47; - void iglms49(in PlacesParams var1, in PendingIntent var2) = 48; - void iglms50(in UserDataType var1, in LatLngBounds var2, in List var3, in PlacesParams var4, IPlacesCallbacks var5) = 49; - IBinder iglms54() = 53; - void iglms55(String var1, in LatLngBounds var2, in AutocompleteFilter var3, in PlacesParams var4, IPlacesCallbacks var5) = 54; - void iglms58(in List var1, in PlacesParams var2, IPlacesCallbacks var3) = 57; - - //void updateDeviceOrientationRequest(in DeviceOrientationRequestUpdateData request) = 74; -} diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/ISettingsCallbacks.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/ISettingsCallbacks.aidl deleted file mode 100644 index f710d11f..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/ISettingsCallbacks.aidl +++ /dev/null @@ -1,7 +0,0 @@ -package com.google.android.gms.location.internal; - -import com.google.android.gms.location.LocationSettingsResult; - -interface ISettingsCallbacks { - void onLocationSettingsResult(in LocationSettingsResult result); -} diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/LocationRequestInternal.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/LocationRequestInternal.aidl deleted file mode 100644 index 4604714a..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/LocationRequestInternal.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location.internal; - -parcelable LocationRequestInternal; diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/LocationRequestUpdateData.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/LocationRequestUpdateData.aidl deleted file mode 100644 index 812f2ca5..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/LocationRequestUpdateData.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location.internal; - -parcelable LocationRequestUpdateData; diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/ParcelableGeofence.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/ParcelableGeofence.aidl deleted file mode 100644 index d4d69547..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/ParcelableGeofence.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location.internal; - -parcelable ParcelableGeofence; \ No newline at end of file diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/AutocompleteFilter.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/AutocompleteFilter.aidl deleted file mode 100644 index 10b7539c..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/AutocompleteFilter.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location.places; - -parcelable AutocompleteFilter; diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/NearbyAlertRequest.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/NearbyAlertRequest.aidl deleted file mode 100644 index b34605c8..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/NearbyAlertRequest.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location.places; - -parcelable NearbyAlertRequest; diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceFilter.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceFilter.aidl deleted file mode 100644 index 07a4eec6..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceFilter.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location.places; - -parcelable PlaceFilter; diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceReport.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceReport.aidl deleted file mode 100644 index 993899de..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceReport.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location.places; - -parcelable PlaceReport; diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceRequest.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceRequest.aidl deleted file mode 100644 index 8de920ef..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceRequest.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location.places; - -parcelable PlaceRequest; diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/UserAddedPlace.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/UserAddedPlace.aidl deleted file mode 100644 index aa543a60..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/UserAddedPlace.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location.places; - -parcelable UserAddedPlace; diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/UserDataType.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/UserDataType.aidl deleted file mode 100644 index 503493a3..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/UserDataType.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location.places; - -parcelable UserDataType; diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/internal/IPlacesCallbacks.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/internal/IPlacesCallbacks.aidl deleted file mode 100644 index 6e912606..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/internal/IPlacesCallbacks.aidl +++ /dev/null @@ -1,9 +0,0 @@ -package com.google.android.gms.location.places.internal; - -import com.google.android.gms.common.data.DataHolder; - -interface IPlacesCallbacks { - void X(in DataHolder dataHolder); - void Y(in DataHolder dataHolder); - void Z(in DataHolder dataHolder); -} diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/internal/PlacesParams.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/internal/PlacesParams.aidl deleted file mode 100644 index fa569540..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/internal/PlacesParams.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location.places.internal; - -parcelable PlacesParams; diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/ReportingState.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/ReportingState.aidl deleted file mode 100644 index 4b1bf63c..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/ReportingState.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location.reporting; - -parcelable ReportingState; \ No newline at end of file diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/UploadRequest.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/UploadRequest.aidl deleted file mode 100644 index 69547d7e..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/UploadRequest.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location.reporting; - -parcelable UploadRequest; \ No newline at end of file diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/UploadRequestResult.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/UploadRequestResult.aidl deleted file mode 100644 index cf3ec3be..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/UploadRequestResult.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.location.reporting; - -parcelable UploadRequestResult; \ No newline at end of file diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/internal/IReportingService.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/internal/IReportingService.aidl deleted file mode 100644 index 715b6779..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/internal/IReportingService.aidl +++ /dev/null @@ -1,15 +0,0 @@ -package com.google.android.gms.location.reporting.internal; - -import android.accounts.Account; -import com.google.android.gms.location.places.PlaceReport; -import com.google.android.gms.location.reporting.ReportingState; -import com.google.android.gms.location.reporting.UploadRequest; -import com.google.android.gms.location.reporting.UploadRequestResult; - -interface IReportingService { - ReportingState getReportingState(in Account account) = 0; - int tryOptIn(in Account account) = 1; - UploadRequestResult requestUpload(in UploadRequest request) = 2; - int cancelUploadRequest(long l) = 3; - int reportDeviceAtPlace(in Account account, in PlaceReport report) = 4; -} diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/maps/model/LatLng.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/maps/model/LatLng.aidl deleted file mode 100644 index 42df9312..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/maps/model/LatLng.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.maps.model; - -parcelable LatLng; diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/maps/model/LatLngBounds.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/maps/model/LatLngBounds.aidl deleted file mode 100644 index 70538794..00000000 --- a/play-services-location-api/src/main/aidl/com/google/android/gms/maps/model/LatLngBounds.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.maps.model; - -parcelable LatLngBounds; \ No newline at end of file diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/ActivityRecognitionResult.java b/play-services-location-api/src/main/java/com/google/android/gms/location/ActivityRecognitionResult.java deleted file mode 100644 index 614c8552..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/ActivityRecognitionResult.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.content.Intent; -import android.os.Bundle; - -import org.microg.gms.common.PublicApi; -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParcelUtil; -import org.microg.safeparcel.SafeParceled; - -import java.util.Collections; -import java.util.List; - -/** - * Result of an activity recognition. - *

- * It contains a list of activities that a user may have been doing at a particular time. The - * activities are sorted by the most probable activity first. A confidence is associated with each - * activity which indicates how likely that activity is. - *

- * {@link #getMostProbableActivity()} will return the most probable activity of the user at the time - * that activity recognition was run. - */ -@PublicApi -public class ActivityRecognitionResult extends AutoSafeParcelable { - - @PublicApi(exclude = true) - public static final String EXTRA_ACTIVITY_RESULT = "com.google.android.location.internal.EXTRA_ACTIVITY_RESULT"; - @PublicApi(exclude = true) - public static final String EXTRA_ACTIVITY_RESULT_LIST = "com.google.android.location.internal.EXTRA_ACTIVITY_RESULT_LIST"; - - @SafeParceled(1000) - private int versionCode = 2; - - @SafeParceled(value = 1, subClass = DetectedActivity.class) - private List probableActivities; - - @SafeParceled(2) - private long time; - - @SafeParceled(3) - private long elapsedRealtimeMillis; - - @SafeParceled(5) - private Bundle extras; - - /** - * Constructs an ActivityRecognitionResult. - * - * @param probableActivities the activities that where detected, sorted by confidence (most probable first). - * @param time the UTC time of this detection, in milliseconds since January 1, 1970. - * @param elapsedRealtimeMillis milliseconds since boot - */ - public ActivityRecognitionResult(List probableActivities, long time, long elapsedRealtimeMillis) { - this(probableActivities, time, elapsedRealtimeMillis, null); - } - - /** - * Constructs an ActivityRecognitionResult from a single activity. - * - * @param activity the most probable activity of the device. - * @param time the UTC time of this detection, in milliseconds since January 1, 1970. - * @param elapsedRealtimeMillis milliseconds since boot - */ - public ActivityRecognitionResult(DetectedActivity activity, long time, long elapsedRealtimeMillis) { - this(Collections.singletonList(activity), time, elapsedRealtimeMillis); - } - - private ActivityRecognitionResult(List probableActivities, long time, long elapsedRealtimeMillis, Bundle extras) { - if (probableActivities == null || probableActivities.isEmpty()) - throw new IllegalArgumentException("Must have at least 1 detected activity"); - if (time <= 0 || elapsedRealtimeMillis <= 0) - throw new IllegalArgumentException("Must set times"); - this.probableActivities = probableActivities; - this.time = time; - this.elapsedRealtimeMillis = elapsedRealtimeMillis; - this.extras = extras; - } - - /** - * Extracts the ActivityRecognitionResult from an Intent. - *

- * This is a utility function which extracts the ActivityRecognitionResult from the extras of - * an Intent that was sent from the activity detection service. - * - * @return an ActivityRecognitionResult, or {@code null} if the intent doesn't contain an - * ActivityRecognitionResult. - */ - public static ActivityRecognitionResult extractResult(Intent intent) { - if (intent.hasExtra(EXTRA_ACTIVITY_RESULT_LIST)) { - intent.setExtrasClassLoader(ActivityRecognitionResult.class.getClassLoader()); - List list = intent.getParcelableArrayListExtra(EXTRA_ACTIVITY_RESULT_LIST); - if (list != null && !list.isEmpty()) - return list.get(list.size() - 1); - } - if (intent.hasExtra(EXTRA_ACTIVITY_RESULT)) { - Bundle extras = intent.getExtras(); - extras.setClassLoader(ActivityRecognitionResult.class.getClassLoader()); - Object res = extras.get(EXTRA_ACTIVITY_RESULT); - if (res instanceof ActivityRecognitionResult) - return (ActivityRecognitionResult) res; - if (res instanceof byte[]) - return SafeParcelUtil.fromByteArray((byte[]) res, CREATOR); - } - return null; - } - - /** - * Returns the confidence of the given activity type. - */ - public int getActivityConfidence(int activityType) { - for (DetectedActivity activity : probableActivities) { - if (activity.getType() == activityType) - return activity.getConfidence(); - } - return 0; - } - - /** - * Returns the elapsed real time of this detection in milliseconds since boot, including time - * spent in sleep as obtained by SystemClock.elapsedRealtime(). - */ - public long getElapsedRealtimeMillis() { - return elapsedRealtimeMillis; - } - - /** - * Returns the most probable activity of the user. - */ - public DetectedActivity getMostProbableActivity() { - return probableActivities.get(0); - } - - /** - * Returns the list of activities that where detected with the confidence value associated with - * each activity. The activities are sorted by most probable activity first. - *

- * The sum of the confidences of all detected activities this method returns does not have to - * be <= 100 since some activities are not mutually exclusive (for example, you can be walking - * while in a bus) and some activities are hierarchical (ON_FOOT is a generalization of WALKING - * and RUNNING). - */ - public List getProbableActivities() { - return probableActivities; - } - - /** - * Returns the UTC time of this detection, in milliseconds since January 1, 1970. - */ - public long getTime() { - return time; - } - - /** - * Returns true if an Intent contains an ActivityRecognitionResult. - *

- * This is a utility function that can be called from inside an intent receiver to make sure - * the received intent is from activity recognition. - * - * @return true if the intent contains an ActivityRecognitionResult, false otherwise or the given intent is null - */ - public static boolean hasResult(Intent intent) { - if (intent == null) return false; - if (intent.hasExtra(EXTRA_ACTIVITY_RESULT)) return true; - intent.setExtrasClassLoader(ActivityRecognitionResult.class.getClassLoader()); - List list = intent.getParcelableArrayListExtra(EXTRA_ACTIVITY_RESULT_LIST); - return list != null && !list.isEmpty(); - } - - @Override - public String toString() { - return "ActivityRecognitionResult [probableActivities=" + probableActivities + ", timeMillis" + time + ", elapsedRealtimeMillis=" + elapsedRealtimeMillis + "]"; - } - - public static final Creator CREATOR = new AutoCreator(ActivityRecognitionResult.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/DetectedActivity.java b/play-services-location-api/src/main/java/com/google/android/gms/location/DetectedActivity.java deleted file mode 100644 index 4a75a4d2..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/DetectedActivity.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (C) 2017 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.location; - -import org.microg.gms.common.PublicApi; -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -/** - * The detected activity of the device with an an associated confidence. See ActivityRecognitionApi - * for details on how to obtain a DetectedActivity. - */ -@PublicApi -public class DetectedActivity extends AutoSafeParcelable { - - /** - * The device is in a vehicle, such as a car. - */ - public static final int IN_VEHICLE = 0; - - /** - * The device is on a bicycle. - */ - public static final int ON_BICYCLE = 1; - - /** - * The device is on a user who is walking or running. - */ - public static final int ON_FOOT = 2; - - /** - * The device is on a user who is running. This is a sub-activity of ON_FOOT. - */ - public static final int RUNNING = 8; - - /** - * The device is still (not moving). - */ - public static final int STILL = 3; - - /** - * The device angle relative to gravity changed significantly. This often occurs when a device - * is picked up from a desk or a user who is sitting stands up. - */ - public static final int TILTING = 5; - - /** - * Unable to detect the current activity. - */ - public static final int UNKNOWN = 4; - - /** - * The device is on a user who is walking. This is a sub-activity of ON_FOOT. - */ - public static final int WALKING = 7; - - @SafeParceled(1000) - private int versionCode = 1; - - @SafeParceled(1) - private int type; - - @SafeParceled(2) - private int confidence; - - private DetectedActivity() { - } - - - /** - * Constructs a DetectedActivity. - * - * @param activityType the activity that was detected. - * @param confidence value from 0 to 100 indicating how likely it is that the user is performing this activity. - */ - public DetectedActivity(int activityType, int confidence) { - this.type = activityType; - this.confidence = confidence; - } - - @PublicApi(exclude = true) - public DetectedActivity(int versionCode, int type, int confidence) { - this.versionCode = versionCode; - this.type = type; - this.confidence = confidence; - } - - /** - * Returns a value from 0 to 100 indicating the likelihood that the user is performing this - * activity. - *

- * The larger the value, the more consistent the data used to perform the classification is - * with the detected activity. - *

- * This value will be <= 100. It means that larger values indicate that it's likely that the - * detected activity is correct, while a value of <= 50 indicates that there may be another - * activity that is just as or more likely. - *

- * Multiple activities may have high confidence values. For example, the ON_FOOT may have a - * confidence of 100 while the RUNNING activity may have a confidence of 95. The sum of the - * confidences of all detected activities for a classification does not have to be <= 100 since - * some activities are not mutually exclusive (for example, you can be walking while in a bus) - * and some activities are hierarchical (ON_FOOT is a generalization of WALKING and RUNNING). - */ - public int getConfidence() { - return confidence; - } - - /** - * Returns the type of activity that was detected. - */ - public int getType() { - return type; - } - - @PublicApi(exclude = true) - public int getVersionCode() { - return versionCode; - } - - @Override - public String toString() { - return "DetectedActivity [type=" + typeToString(getType()) + ", confidence=" + getConfidence() + "]"; - } - - @PublicApi(exclude = true) - public static String typeToString(int type) { - switch (type) { - case 0: - return "IN_VEHICLE"; - case 1: - return "ON_BICYCLE"; - case 2: - return "ON_FOOT"; - case 3: - return "STILL"; - case 4: - return "UNKNOWN"; - case 5: - return "TILTING"; - case 6: - default: - return Integer.toString(type); - case 7: - return "WALKING"; - case 8: - return "RUNNING"; - } - } - - public static final Creator CREATOR = new AutoCreator(DetectedActivity.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/Geofence.java b/play-services-location-api/src/main/java/com/google/android/gms/location/Geofence.java deleted file mode 100644 index 194aed75..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/Geofence.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.os.SystemClock; - -import com.google.android.gms.location.internal.ParcelableGeofence; - -/** - * Represents a geographical region, also known as a geofence. Geofences can be monitored by - * geofencer service. And when the user crosses the boundary of a geofence, an alert will be - * generated. - */ -public interface Geofence { - int GEOFENCE_TRANSITION_DWELL = 4; - - /** - * The transition type indicating that the user enters the geofence(s). - */ - int GEOFENCE_TRANSITION_ENTER = 1; - - /** - * The transition type indicating that the user exits the geofence(s). - */ - int GEOFENCE_TRANSITION_EXIT = 2; - - /** - * Expiration value that indicates the geofence should never expire. - */ - long NEVER_EXPIRE = -1L; - - /** - * Returns the request ID of this geofence. The request ID is a string to identify this geofence - * inside your application. When two geofences with the same requestId are monitored, the new - * one will replace the old one regardless the geographical region these two geofences - * represent. - */ - String getRequestId(); - - /** - * A builder that builds {@link Geofence}. - */ - class Builder { - private int regionType = -1; - private double latitude; - private double longitude; - private float radius; - private long expirationTime = Long.MIN_VALUE; - private int loiteringDelay = -1; - private int notificationResponsiveness; - private String requestId; - private int transitionTypes; - - /** - * Creates a geofence object. - * - * @throws IllegalArgumentException if any parameters are not set or out of range - */ - public Geofence build() throws IllegalArgumentException { - if (requestId == null) { - throw new IllegalArgumentException("Request ID not set."); - } else if (transitionTypes == 0) { - throw new IllegalArgumentException("Transition types not set."); - } else if ((transitionTypes & GEOFENCE_TRANSITION_DWELL) > 0 && loiteringDelay < 0) { - throw new IllegalArgumentException("Non-negative loitering delay needs to be set when transition types include GEOFENCE_TRANSITION_DWELLING."); - } else if (expirationTime == Long.MIN_VALUE) { - throw new IllegalArgumentException("Expiration not set."); - } else if (regionType == -1) { - throw new IllegalArgumentException("Geofence region not set."); - } else if (notificationResponsiveness < 0) { - throw new IllegalArgumentException("Notification responsiveness should be nonnegative."); - } else { - return new ParcelableGeofence(requestId, expirationTime, regionType, latitude, longitude, radius, transitionTypes, notificationResponsiveness, loiteringDelay); - } - } - - /** - * Sets the region of this geofence. The geofence represents a circular area on a flat, horizontal plane. - * - * @param latitude latitude in degrees, between -90 and +90 inclusive - * @param longitude longitude in degrees, between -180 and +180 inclusive - * @param radius radius in meters - */ - public Builder setCircularRegion(double latitude, double longitude, float radius) { - this.regionType = 1; - this.latitude = latitude; - this.longitude = longitude; - this.radius = radius; - return this; - } - - /** - * Sets the expiration duration of geofence. This geofence will be removed automatically - * after this period of time. - * - * @param durationMillis time for this proximity alert, in milliseconds, or {@link #NEVER_EXPIRE} - * to indicate no expiration. When positive, this geofence will be - * removed automatically after this amount of time. - */ - public Builder setExpirationDuration(long durationMillis) { - if (durationMillis < 0) { - expirationTime = -1; - } else { - expirationTime = SystemClock.elapsedRealtime() + durationMillis; - } - return this; - } - - public Builder setLoiteringDelay(int loiteringDelayMs) { - this.loiteringDelay = loiteringDelayMs; - return this; - } - - /** - * Sets the best-effort notification responsiveness of the geofence. Defaults to 0. Setting - * a big responsiveness value, for example 5 minutes, can save power significantly. However, - * setting a very small responsiveness value, for example 5 seconds, doesn't necessarily - * mean you will get notified right after the user enters or exits a geofence: internally, - * the geofence might adjust the responsiveness value to save power when needed. - * - * @param notificationResponsivenessMs notificationResponsivenessMs (milliseconds) defines - * the best-effort description of how soon should the - * callback be called when the transition associated - * with the Geofence is triggered. For instance, if set - * to 300000 milliseconds the callback will be called 5 - * minutes within entering or exiting the geofence. - */ - public Builder setNotificationResponsiveness(int notificationResponsivenessMs) { - this.notificationResponsiveness = notificationResponsivenessMs; - return this; - } - - /** - * Sets the request ID of the geofence. Request ID is a string to identify this geofence - * inside your application. When two geofences with the same requestId are monitored, the - * new one will replace the old one regardless the geographical region these two geofences - * represent. - * - * @param requestId the request ID. The length of the string can be up to 100 characters. - */ - public Builder setRequestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Sets the transition types of interest. Alerts are only generated for the given transition - * types. - * - * @param transitionTypes geofence transition types of interest, as a bitwise-OR of - * GEOFENCE_TRANSITION_ flags. - */ - public Builder setTransitionTypes(int transitionTypes) { - this.transitionTypes = transitionTypes; - return this; - } - } -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/GeofenceStatusCodes.java b/play-services-location-api/src/main/java/com/google/android/gms/location/GeofenceStatusCodes.java deleted file mode 100644 index 8733e4cb..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/GeofenceStatusCodes.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2017 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.location; - -import com.google.android.gms.common.api.CommonStatusCodes; - -public class GeofenceStatusCodes extends CommonStatusCodes { - /** - * Geofence service is not available now. Typically this is because the user turned off - * location access in settings > location access. - */ - public static final int GEOFENCE_NOT_AVAILABLE = 1000; - - /** - * Your app has registered more than 100 geofences. Remove unused ones before adding new - * geofences. - */ - public static final int GEOFENCE_TOO_MANY_GEOFENCES = 1001; - - /** - * You have provided more than 5 different PendingIntents to the addGeofences(GoogleApiClient, - * GeofencingRequest, PendingIntent) call. - */ - public static final int GEOFENCE_TOO_MANY_PENDING_INTENTS = 1002; - - /** - * Returns an untranslated debug (not user-friendly!) string based on the current status code. - */ - public static String getStatusCodeString(int statusCode) { - switch (statusCode) { - case GEOFENCE_NOT_AVAILABLE: - return "GEOFENCE_NOT_AVAILABLE"; - case GEOFENCE_TOO_MANY_GEOFENCES: - return "GEOFENCE_TOO_MANY_GEOFENCES"; - case GEOFENCE_TOO_MANY_PENDING_INTENTS: - return "GEOFENCE_TOO_MANY_PENDING_INTENTS"; - default: - return CommonStatusCodes.getStatusCodeString(statusCode); - } - } -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/GeofencingEvent.java b/play-services-location-api/src/main/java/com/google/android/gms/location/GeofencingEvent.java deleted file mode 100644 index 82b3a107..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/GeofencingEvent.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (C) 2017 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.location; - -import android.content.Intent; -import android.location.Location; - -import com.google.android.gms.location.internal.ParcelableGeofence; - -import org.microg.gms.common.PublicApi; -import org.microg.safeparcel.SafeParcelUtil; - -import java.util.ArrayList; -import java.util.List; - -/** - * Represents an event from the GeofencingApi API. The event can be - *

- * A geofence triggering event generated when a geofence transition happens. - * An error happens after geofences are registered and being monitored. - */ -@PublicApi -public class GeofencingEvent { - @PublicApi(exclude = true) - public static final String EXTRA_ERROR_CODE = "gms_error_code"; - @PublicApi(exclude = true) - public static final String EXTRA_TRIGGERING_LOCATION = "com.google.android.location.intent.extra.triggering_location"; - @PublicApi(exclude = true) - public static final String EXTRA_TRANSITION = "com.google.android.location.intent.extra.transition"; - @PublicApi(exclude = true) - public static final String EXTRA_GEOFENCE_LIST = "com.google.android.location.intent.extra.geofence_list"; - - private int errorCode; - private int geofenceTransition; - private List triggeringGeofences; - private Location triggeringLocation; - - /** - * Creates a {@link GeofencingEvent} object from the given intent. - * - * @param intent the intent to extract the geofencing event data from - * @return a {@link GeofencingEvent} object or {@code null} if the given intent is {@code null} - */ - public static GeofencingEvent fromIntent(Intent intent) { - if (intent == null) { - return null; - } - GeofencingEvent event = new GeofencingEvent(); - event.errorCode = intent.getIntExtra(EXTRA_ERROR_CODE, -1); - event.geofenceTransition = intent.getIntExtra(EXTRA_TRANSITION, -1); - if (event.geofenceTransition != 1 && event.geofenceTransition != 2 && event.geofenceTransition != 4) - event.geofenceTransition = -1; - ArrayList parceledGeofences = (ArrayList) intent.getSerializableExtra(EXTRA_GEOFENCE_LIST); - if (parceledGeofences != null) { - event.triggeringGeofences = new ArrayList(); - for (byte[] parceledGeofence : parceledGeofences) { - event.triggeringGeofences.add(SafeParcelUtil.fromByteArray(parceledGeofence, ParcelableGeofence.CREATOR)); - } - } - event.triggeringLocation = intent.getParcelableExtra(EXTRA_TRIGGERING_LOCATION); - return event; - } - - /** - * Returns the error code that explains the error that triggered the intent specified in - * {@link #fromIntent(Intent)}. - * - * @return the error code specified in {@link GeofenceStatusCodes} or {@code -1} if - * {@link #hasError()} returns false. - */ - public int getErrorCode() { - return errorCode; - } - - /** - * Returns the transition type of the geofence transition alert. - * - * @return -1 if the intent specified in {@link #fromIntent(Intent)} is not generated for a - * transition alert; Otherwise returns the GEOFENCE_TRANSITION_ flags value defined in - * {@link Geofence}. - */ - public int getGeofenceTransition() { - return geofenceTransition; - } - - - /** - * Returns a list of geofences that triggered this geofence transition alert. - * - * @return a list of geofences that triggered this geofence transition alert or {@code null} if - * the intent specified in {@link #fromIntent(Intent)} is not generated for a geofence - * transition alert - */ - public List getTriggeringGeofences() { - return triggeringGeofences; - } - - /** - * Gets the location that triggered the geofence transition. Triggering location is only - * available if the calling app links against Google Play services 5.0 SDK. - * - * @return the location that triggered this geofence alert or {@code null} if it's not included - * in the intent specified in {@link #fromIntent(Intent)} - */ - public Location getTriggeringLocation() { - return triggeringLocation; - } - - /** - * Whether an error triggered this intent. - * - * @return {@code true} if an error triggered the intent specified in - * {@link #fromIntent(Intent)}, otherwise {@code false} - */ - public boolean hasError() { - return errorCode != -1; - } -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/GeofencingRequest.java b/play-services-location-api/src/main/java/com/google/android/gms/location/GeofencingRequest.java deleted file mode 100644 index 2601d629..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/GeofencingRequest.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import org.microg.safeparcel.AutoSafeParcelable; - -/** - * TODO: usage - */ -public class GeofencingRequest extends AutoSafeParcelable { - - public static final Creator CREATOR = new AutoCreator(GeofencingRequest.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/GestureRequest.java b/play-services-location-api/src/main/java/com/google/android/gms/location/GestureRequest.java deleted file mode 100644 index 5222b259..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/GestureRequest.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class GestureRequest extends AutoSafeParcelable { - public static final Creator CREATOR = new AutoCreator(GestureRequest.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationAvailability.java b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationAvailability.java deleted file mode 100644 index c24c5bbc..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationAvailability.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.content.Intent; - -import org.microg.gms.common.PublicApi; -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -import java.util.Arrays; - -/** - * Status on the availability of location data. - *

- * Delivered from LocationCallback registered via FusedLocationProviderApi#requestLocationUpdates(GoogleApiClient, LocationRequest, LocationCallback, Looper) - * or from a PendingIntent registered via FusedLocationProviderApi#requestLocationUpdates(GoogleApiClient, LocationRequest, PendingIntent). - * It is also available on demand via FusedLocationProviderApi#getLocationAvailability(GoogleApiClient). - */ -@PublicApi -public class LocationAvailability extends AutoSafeParcelable { - private static final String EXTRA_KEY = "com.google.android.gms.location.EXTRA_LOCATION_AVAILABILITY"; - - @PublicApi(exclude = true) - public static final int STATUS_SUCCESSFUL = 0; - @PublicApi(exclude = true) - public static final int STATUS_UNKNOWN = 1; - @PublicApi(exclude = true) - public static final int STATUS_TIMED_OUT_ON_SCAN = 2; - @PublicApi(exclude = true) - public static final int STATUS_NO_INFO_IN_DATABASE = 3; - @PublicApi(exclude = true) - public static final int STATUS_INVALID_SCAN = 4; - @PublicApi(exclude = true) - public static final int STATUS_UNABLE_TO_QUERY_DATABASE = 5; - @PublicApi(exclude = true) - public static final int STATUS_SCANS_DISABLED_IN_SETTINGS = 6; - @PublicApi(exclude = true) - public static final int STATUS_LOCATION_DISABLED_IN_SETTINGS = 7; - @PublicApi(exclude = true) - public static final int STATUS_IN_PROGRESS = 8; - - @SafeParceled(1000) - private int versionCode = 2; - - @SafeParceled(1) - @PublicApi(exclude = true) - public int cellStatus; - - @SafeParceled(2) - @PublicApi(exclude = true) - public int wifiStatus; - - @SafeParceled(3) - @PublicApi(exclude = true) - public long elapsedRealtimeNs; - - @SafeParceled(4) - @PublicApi(exclude = true) - public int locationStatus; - - @PublicApi(exclude = true) - public LocationAvailability() { - } - - @Override - public boolean equals(Object o) { - if (o instanceof LocationAvailability) { - LocationAvailability other = (LocationAvailability) o; - return other.cellStatus == cellStatus && other.wifiStatus == wifiStatus && other.elapsedRealtimeNs == elapsedRealtimeNs && other.locationStatus == locationStatus; - } - return false; - } - - /** - * Extracts the {@link LocationAvailability} from an Intent. - *

- * This is a utility function which extracts the {@link LocationAvailability} from the extras - * of an Intent that was sent in response to a location request. - * - * @return a {@link LocationAvailability}, or null if the Intent doesn't contain this data. - */ - public static LocationAvailability extractLocationAvailability(Intent intent) { - if (!hasLocationAvailability(intent)) { - return null; - } - return intent.getParcelableExtra(EXTRA_KEY); - } - - /** - * Returns true if an Intent contains a {@link LocationAvailability}. - *

- * This is a utility function that can be called from inside an intent receiver to make sure the - * received intent contains location availability data. - * - * @return true if the intent contains a {@link LocationAvailability}, false otherwise. - */ - public static boolean hasLocationAvailability(Intent intent) { - return intent != null && intent.hasExtra(EXTRA_KEY); - } - - @Override - public int hashCode() { - return Arrays.hashCode(new Object[]{locationStatus, cellStatus, wifiStatus, elapsedRealtimeNs}); - } - - /** - * Returns true if the device location is known and reasonably up to date within the hints - * requested by the active {@link LocationRequest}s. Failure to determine location may result - * from a number of causes including disabled location settings or an inability to retrieve - * sensor data in the device's environment. - */ - public boolean isLocationAvailable() { - return locationStatus < 1000; - } - - @Override - public String toString() { - return "LocationAvailability[isLocationAvailable: " + isLocationAvailable() + "]"; - } - - public static final Creator CREATOR = new AutoCreator(LocationAvailability.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationRequest.java b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationRequest.java deleted file mode 100644 index 15d159e8..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationRequest.java +++ /dev/null @@ -1,439 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.os.SystemClock; -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -import java.util.Arrays; - -/** - * A data object that contains quality of service parameters for requests to the - * FusedLocationProviderApi. - *

- * LocationRequest objects are used to request a quality of service for location updates from the - * FusedLocationProviderApi. - *

- * For example, if your application wants high accuracy location it should create a location - * request with {@link #setPriority(int)} set to {@link #PRIORITY_HIGH_ACCURACY} and - * {@link #setInterval(long)} to 5 seconds. This would be appropriate for mapping applications that - * are showing your location in real-time. - *

- * At the other extreme, if you want negligible power impact, but to still receive location updates - * when available, then create a location request with {@link #setPriority(int)} set to - * {@link #PRIORITY_NO_POWER}. With this request your application will not trigger (and therefore - * will not receive any power blame) any location updates, but will receive locations triggered by - * other applications. This would be appropriate for applications that have no firm requirement for - * location, but can take advantage when available. - *

- * In between these two extremes is a very common use-case, where applications definitely want to - * receive updates at a specified interval, and can receive them faster when available, but still - * want a low power impact. These applications should consider - * {@link #PRIORITY_BALANCED_POWER_ACCURACY} combined with a faster - * {@link #setFastestInterval(long)} (such as 1 minute) and a slower {@link #setInterval(long)} - * (such as 60 minutes). They will only be assigned power blame for the interval set by - * {@link #setInterval(long)}, but can still receive locations triggered by other applications at a - * rate up to {@link #setFastestInterval(long)}. This style of request is appropriate for many - * location aware applications, including background usage. Do be careful to also throttle - * {@link #setFastestInterval(long)} if you perform heavy-weight work after receiving an update - - * such as using the network. - *

- * Activities should strongly consider removing all location request when entering the background - * (for example at {@link android.app.Activity#onPause()}), or at least swap the request to a - * larger interval and lower quality. - *

- * Applications cannot specify the exact location sources, such as GPS, that are used by the - * LocationClient. In fact, the system may have multiple location sources (providers) running and - * may fuse the results from several sources into a single Location object. - *

- * Location requests from applications with - * {@link android.Manifest.permission#ACCESS_COARSE_LOCATION} and not - * {@link android.Manifest.permission#ACCESS_FINE_LOCATION} will be automatically throttled to a - * slower interval, and the location object will be obfuscated to only show a coarse level of - * accuracy. - *

- * All location requests are considered hints, and you may receive locations that are more/less - * accurate, and faster/slower than requested. - */ -public class LocationRequest extends AutoSafeParcelable { - - /** - * Used with {@link #setPriority(int)} to request "block" level accuracy. - *

- * Block level accuracy is considered to be about 100 meter accuracy. Using a coarse accuracy - * such as this often consumes less power. - */ - public static final int PRIORITY_BALANCED_POWER_ACCURACY = 102; - /** - * Used with {@link #setPriority(int)} to request the most accurate locations available. - *

- * This will return the finest location available. - */ - public static final int PRIORITY_HIGH_ACCURACY = 100; - /** - * Used with {@link #setPriority(int)} to request "city" level accuracy. - *

- * City level accuracy is considered to be about 10km accuracy. Using a coarse accuracy such as - * this often consumes less power. - */ - public static final int PRIORITY_LOW_POWER = 104; - /** - * Used with {@link #setPriority(int)} to request the best accuracy possible with zero - * additional power consumption. - *

- * No locations will be returned unless a different client has requested location updates in - * which case this request will act as a passive listener to those locations. - */ - public static final int PRIORITY_NO_POWER = 105; - - @SafeParceled(1000) - private int versionCode = 1; - @SafeParceled(1) - private int priority; - @SafeParceled(2) - private long interval; - @SafeParceled(3) - private long fastestInterval; - @SafeParceled(4) - private boolean explicitFastestInterval; - @SafeParceled(5) - private long expirationTime; - @SafeParceled(6) - private int numUpdates; - @SafeParceled(7) - private float smallestDesplacement; - @SafeParceled(8) - private long maxWaitTime; - - public LocationRequest() { - this.priority = PRIORITY_BALANCED_POWER_ACCURACY; - this.interval = 3600000; - this.fastestInterval = 600000; - this.explicitFastestInterval = false; - this.expirationTime = Long.MAX_VALUE; - this.numUpdates = Integer.MAX_VALUE; - this.smallestDesplacement = 0; - this.maxWaitTime = 0; - } - - /** - * Create a location request with default parameters. - *

- * Default parameters are for a block accuracy, slowly updated location. It can then be - * adjusted as required by the applications before passing to the FusedLocationProviderApi. - * - * @return a new location request - */ - public static LocationRequest create() { - return new LocationRequest(); - } - - /** - * Get the request expiration time, in milliseconds since boot. - *

- * This value can be compared to {@link SystemClock#elapsedRealtime()} to determine - * the time until expiration. - * - * @return expiration time of request, in milliseconds since boot including suspend - */ - public long getExpirationTime() { - return expirationTime; - } - - /** - * Get the fastest interval of this request, in milliseconds. - *

- * The system will never provide location updates faster than the minimum of - * {@link #getFastestInterval()} and {@link #getInterval()}. - * - * @return fastest interval in milliseconds, exact - */ - public long getFastestInterval() { - return fastestInterval; - } - - /** - * Get the desired interval of this request, in milliseconds. - * - * @return desired interval in milliseconds, inexact - */ - public long getInterval() { - return interval; - } - - /** - * Get the number of updates requested. - *

- * By default this is {@link java.lang.Integer#MAX_VALUE}, which indicates that locations are - * updated until the request is explicitly removed. - * - * @return number of updates - */ - public int getNumUpdates() { - return numUpdates; - } - - /** - * Get the quality of the request. - * - * @return an accuracy constant - */ - public int getPriority() { - return priority; - } - - /** - * Get the minimum displacement between location updates in meters - *

- * By default this is 0. - * - * @return minimum displacement between location updates in meters - */ - public float getSmallestDesplacement() { - return smallestDesplacement; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - - LocationRequest that = (LocationRequest) o; - - if (expirationTime != that.expirationTime) - return false; - if (explicitFastestInterval != that.explicitFastestInterval) - return false; - if (fastestInterval != that.fastestInterval) - return false; - if (interval != that.interval) - return false; - if (maxWaitTime != that.maxWaitTime) - return false; - if (numUpdates != that.numUpdates) - return false; - if (priority != that.priority) - return false; - if (Float.compare(that.smallestDesplacement, smallestDesplacement) != 0) - return false; - - return true; - } - - @Override - public int hashCode() { - return Arrays.hashCode( - new Object[] { priority, interval, fastestInterval, explicitFastestInterval, - explicitFastestInterval, numUpdates, smallestDesplacement, maxWaitTime - }); - } - - /** - * Set the duration of this request, in milliseconds. - *

- * The duration begins immediately (and not when the request is passed to the location client), - * so call this method again if the request is re-used at a later time. - *

- * The location client will automatically stop updates after the request expires. - *

- * The duration includes suspend time. Values less than 0 are allowed, but indicate that the - * request has already expired. - * - * @param millis duration of request in milliseconds - * @return the same object, so that setters can be chained - */ - public LocationRequest setExpirationDuration(long millis) { - expirationTime = SystemClock.elapsedRealtime() + millis; - return this; - } - - /** - * Set the request expiration time, in millisecond since boot. - *

- * This expiration time uses the same time base as {@link SystemClock#elapsedRealtime()}. - *

- * The location client will automatically stop updates after the request expires. - *

- * The duration includes suspend time. Values before {@link SystemClock#elapsedRealtime()} are - * allowed, but indicate that the request has already expired. - * - * @param millis expiration time of request, in milliseconds since boot including suspend - * @return the same object, so that setters can be chained - */ - public LocationRequest setExpirationTime(long millis) { - expirationTime = millis; - return this; - } - - /** - * Explicitly set the fastest interval for location updates, in milliseconds. - *

- * This controls the fastest rate at which your application will receive location updates, - * which might be faster than {@link #setInterval(long)} in some situations (for example, if - * other applications are triggering location updates). - *

- * This allows your application to passively acquire locations at a rate faster than it - * actively acquires locations, saving power. - *

- * Unlike {@link #setInterval(long)}, this parameter is exact. Your application will never - * receive updates faster than this value. - *

- * If you don't call this method, a fastest interval will be selected for you. It will be a - * value faster than your active interval ({@link #setInterval(long)}). - *

- * An interval of 0 is allowed, but not recommended, since location updates may be extremely - * fast on future implementations. - *

- * If {@link #setFastestInterval(long)} is set slower than {@link #setInterval(long)}, then - * your effective fastest interval is {@link #setInterval(long)}. - * - * @param millis fastest interval for updates in milliseconds, exact - * @return the same object, so that setters can be chained - * @throws IllegalArgumentException if the interval is less than zero - */ - public LocationRequest setFastestInterval(long millis) throws IllegalArgumentException { - if (millis < 0) - throw new IllegalArgumentException("interval must not be negative"); - fastestInterval = millis; - return this; - } - - /** - * Set the desired interval for active location updates, in milliseconds. - *

- * The location client will actively try to obtain location updates for your application at - * this interval, so it has a direct influence on the amount of power used by your application. - * Choose your interval wisely. - *

- * This interval is inexact. You may not receive updates at all (if no location sources are - * available), or you may receive them slower than requested. You may also receive them faster - * than requested (if other applications are requesting location at a faster interval). The - * fastest rate that that you will receive updates can be controlled with - * {@link #setFastestInterval(long)}. By default this fastest rate is 6x the interval frequency. - *

- * Applications with only the coarse location permission may have their interval silently - * throttled. - *

- * An interval of 0 is allowed, but not recommended, since location updates may be extremely - * fast on future implementations. - *

- * {@link #setPriority(int)} and {@link #setInterval(long)} are the most important parameters - * on a location request. - * - * @param millis desired interval in millisecond, inexact - * @return the same object, so that setters can be chained - * @throws IllegalArgumentException if the interval is less than zero - */ - public LocationRequest setInterval(long millis) throws IllegalArgumentException { - if (millis < 0) - throw new IllegalArgumentException("interval must not be negative"); - interval = millis; - return this; - } - - /** - * Set the number of location updates. - *

- * By default locations are continuously updated until the request is explicitly removed, - * however you can optionally request a set number of updates. For example, if your application - * only needs a single fresh location, then call this method with a value of 1 before passing - * the request to the location client. - *

- * When using this option care must be taken to either explicitly remove the request when no - * longer needed or to set an expiration with ({@link #setExpirationDuration(long)} or - * {@link #setExpirationTime(long)}. Otherwise in some cases if a location can't be computed, - * this request could stay active indefinitely consuming power. - * - * @param numUpdates the number of location updates requested - * @return the same object, so that setters can be chained - * @throws IllegalArgumentException if numUpdates is 0 or less - */ - public LocationRequest setNumUpdates(int numUpdates) throws IllegalArgumentException { - if (numUpdates <= 0) - throw new IllegalArgumentException("numUpdates must not be 0 or negative"); - this.numUpdates = numUpdates; - return this; - } - - /** - * Set the priority of the request. - *

- * Use with a priority constant such as {@link #PRIORITY_HIGH_ACCURACY}. No other values are - * accepted. - *

- * The priority of the request is a strong hint to the LocationClient for which location - * sources to use. For example, {@link #PRIORITY_HIGH_ACCURACY} is more likely to use GPS, and - * {@link #PRIORITY_BALANCED_POWER_ACCURACY} is more likely to use WIFI & Cell tower - * positioning, but it also depends on many other factors (such as which sources are available) - * and is implementation dependent. - *

- * {@link #setPriority(int)} and {@link #setInterval(long)} are the most important parameters - * on a location request. - * - * @param priority an accuracy or power constant - * @return the same object, so that setters can be chained - * @throws IllegalArgumentException if the quality constant is not valid - */ - public LocationRequest setPriority(int priority) { - switch (priority) { - default: - throw new IllegalArgumentException("priority is not a known constant"); - case PRIORITY_BALANCED_POWER_ACCURACY: - case PRIORITY_HIGH_ACCURACY: - case PRIORITY_LOW_POWER: - case PRIORITY_NO_POWER: - this.priority = priority; - } - return this; - } - - /** - * Set the minimum displacement between location updates in meters - *

- * By default this is 0. - * - * @param smallestDisplacementMeters the smallest displacement in meters the user must move - * between location updates. - * @return the same object, so that setters can be chained - * @throws IllegalArgumentException if smallestDisplacementMeters is negative - */ - public LocationRequest setSmallestDisplacement(float smallestDisplacementMeters) { - if (smallestDisplacementMeters < 0) - throw new IllegalArgumentException("smallestDisplacementMeters must not be negative"); - this.smallestDesplacement = smallestDisplacementMeters; - return this; - } - - @Override - public String toString() { - return "LocationRequest{" + - "priority=" + priority + - ", interval=" + interval + - ", fastestInterval=" + fastestInterval + - ", explicitFastestInterval=" + explicitFastestInterval + - ", expirationTime=" + expirationTime + - ", numUpdates=" + numUpdates + - ", smallestDesplacement=" + smallestDesplacement + - ", maxWaitTime=" + maxWaitTime + - '}'; - } - - public static final Creator CREATOR = new AutoCreator(LocationRequest.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationResult.java b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationResult.java deleted file mode 100644 index d09109fe..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationResult.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.location.Location; - -import org.microg.gms.common.PublicApi; -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -import java.util.List; - -@PublicApi -public class LocationResult extends AutoSafeParcelable { - - @SafeParceled(1000) - private int versionCode = 2; - - @SafeParceled(value = 1, subClass = Location.class) - public final List locations; - - private LocationResult(List locations) { - this.locations = locations; - } - - public static LocationResult create(List locations) { - return new LocationResult(locations); - } - - public static final Creator CREATOR = new AutoCreator(LocationResult.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsRequest.java b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsRequest.java deleted file mode 100644 index 517ab1c8..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsRequest.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import org.microg.gms.common.PublicApi; -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -@PublicApi -public class LocationSettingsRequest extends AutoSafeParcelable { - @SafeParceled(1000) - private int versionCode = 2; - - @SafeParceled(value = 1, subClass = LocationRequest.class) - @PublicApi(exclude = true) - public List requests; - - @SafeParceled(2) - @PublicApi(exclude = true) - public boolean alwaysShow; - - @PublicApi(exclude = true) - public boolean needBle; - - private LocationSettingsRequest() { - } - - private LocationSettingsRequest(List requests, boolean alwaysShow, boolean needBle) { - this.requests = requests; - this.alwaysShow = alwaysShow; - this.needBle = needBle; - } - - /** - * A builder that builds {@link LocationSettingsRequest}. - */ - public static class Builder { - private List requests = new ArrayList(); - private boolean alwaysShow = false; - private boolean needBle = false; - - /** - * Adds a collection of {@link LocationRequest}s that the client is interested in. Settings - * will be checked for optimal performance of all {@link LocationRequest}s. - */ - public Builder addAllLocationRequests(Collection requests) { - this.requests.addAll(requests); - return this; - } - - /** - * Adds one {@link LocationRequest} that the client is interested in. Settings will be - * checked for optimal performance of all {@link LocationRequest}s. - */ - public Builder addLocationRequest(LocationRequest request) { - requests.add(request); - return this; - } - - /** - * Creates a LocationSettingsRequest that can be used with SettingsApi. - */ - public LocationSettingsRequest build() { - return new LocationSettingsRequest(requests, alwaysShow, needBle); - } - - /** - * Whether or not location is required by the calling app in order to continue. Set this to - * true if location is required to continue and false if having location provides better - * results, but is not required. This changes the wording/appearance of the dialog - * accordingly. - */ - public Builder setAlwaysShow(boolean show) { - alwaysShow = show; - return this; - } - - /** - * Sets whether the client wants BLE scan to be enabled. When this flag is set to true, if - * the platform supports BLE scan mode and Bluetooth is off, the dialog will prompt the - * user to enable BLE scan. If the platform doesn't support BLE scan mode, the dialog will - * prompt to enable Bluetooth. - */ - public Builder setNeedBle(boolean needBle) { - this.needBle = needBle; - return this; - } - } - - public static final Creator CREATOR = new AutoCreator(LocationSettingsRequest.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsResult.java b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsResult.java deleted file mode 100644 index 4269b429..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsResult.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import com.google.android.gms.common.api.Result; -import com.google.android.gms.common.api.Status; - -import org.microg.gms.common.PublicApi; -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -/** - * Result of checking settings via checkLocationSettings(GoogleApiClient, LocationSettingsRequest), - * indicates whether a dialog should be shown to ask the user's consent to change their settings. - * The method getStatus() can be be used to confirm if the request was successful. If the current - * location settings don't satisfy the app's requirements and the user has permission to change the - * settings, the app could use startResolutionForResult(Activity, int) to start an intent to show a - * dialog, asking for user's consent to change the settings. The current location settings states - * can be accessed via getLocationSettingsStates(). See LocationSettingsResult for more details. - */ -@PublicApi -public class LocationSettingsResult extends AutoSafeParcelable implements Result { - - @SafeParceled(1000) - private int versionCode = 1; - - @SafeParceled(1) - private Status status; - - @SafeParceled(2) - private LocationSettingsStates settings; - - - /** - * Retrieves the location settings states. - */ - public LocationSettingsStates getLocationSettingsStates() { - return settings; - } - - @Override - public Status getStatus() { - return status; - } - - @PublicApi(exclude = true) - public LocationSettingsResult(LocationSettingsStates settings, Status status) { - this.settings = settings; - this.status = status; - } - - @PublicApi(exclude = true) - public LocationSettingsResult(Status status) { - this.status = status; - } - - public static final Creator CREATOR = new AutoCreator(LocationSettingsResult.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsStates.java b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsStates.java deleted file mode 100644 index 194982b2..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsStates.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import org.microg.gms.common.PublicApi; -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -/** - * Stores the current states of all location-related settings. - */ -@PublicApi -public class LocationSettingsStates extends AutoSafeParcelable { - - @SafeParceled(1000) - private int versionCode = 2; - - @SafeParceled(1) - private boolean gpsUsable; - - @SafeParceled(2) - private boolean networkLocationUsable; - - @SafeParceled(3) - private boolean bleUsable; - - @SafeParceled(4) - private boolean gpsPresent; - - @SafeParceled(5) - private boolean networkLocationPresent; - - @SafeParceled(6) - private boolean blePresent; - - public boolean isBlePresent() { - return blePresent; - } - - public boolean isBleUsable() { - return bleUsable; - } - - public boolean isGpsPresent() { - return gpsPresent; - } - - public boolean isGpsUsable() { - return gpsUsable; - } - - public boolean isLocationPresent() { - return isGpsPresent() || isNetworkLocationPresent(); - } - - public boolean isLocationUsable() { - return isGpsUsable() || isNetworkLocationUsable(); - } - - public boolean isNetworkLocationPresent() { - return networkLocationPresent; - } - - public boolean isNetworkLocationUsable() { - return networkLocationUsable; - } - - public LocationSettingsStates(boolean gpsUsable, boolean networkLocationUsable, boolean bleUsable, boolean gpsPresent, boolean networkLocationPresent, boolean blePresent) { - this.gpsUsable = gpsUsable; - this.networkLocationUsable = networkLocationUsable; - this.bleUsable = bleUsable; - this.gpsPresent = gpsPresent; - this.networkLocationPresent = networkLocationPresent; - this.blePresent = blePresent; - } - - public static final Creator CREATOR = new AutoCreator(LocationSettingsStates.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsStatusCodes.java b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsStatusCodes.java deleted file mode 100644 index 028de68c..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsStatusCodes.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2017 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.location; - -import com.google.android.gms.common.api.CommonStatusCodes; -import com.google.android.gms.common.api.Status; - -import org.microg.gms.common.PublicApi; - -/** - * Location settings specific status codes, for use in {@link Status#getStatusCode()} - */ -@PublicApi -public class LocationSettingsStatusCodes extends CommonStatusCodes { - /** - * Location settings can't be changed to meet the requirements, no dialog pops up - */ - public static final int SETTINGS_CHANGE_UNAVAILABLE = 8502; -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationStatus.java b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationStatus.java deleted file mode 100644 index 6cd2060a..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationStatus.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -import java.util.Arrays; - -public class LocationStatus extends AutoSafeParcelable { - public static final int STATUS_SUCCESSFUL = 0; - public static final int STATUS_UNKNOWN = 1; - public static final int STATUS_TIMED_OUT_ON_SCAN = 2; - public static final int STATUS_NO_INFO_IN_DATABASE = 3; - public static final int STATUS_INVALID_SCAN = 4; - public static final int STATUS_UNABLE_TO_QUERY_DATABASE = 5; - public static final int STATUS_SCANS_DISABLED_IN_SETTINGS = 6; - public static final int STATUS_LOCATION_DISABLED_IN_SETTINGS = 7; - public static final int STATUS_IN_PROGRESS = 8; - @SafeParceled(1000) - private int versionCode = 1; - @SafeParceled(1) - int cellStatus; - @SafeParceled(2) - int wifiStatus; - @SafeParceled(3) - long elapsedRealtimeNanos; - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - - LocationStatus that = (LocationStatus) o; - - if (cellStatus != that.cellStatus) - return false; - if (elapsedRealtimeNanos != that.elapsedRealtimeNanos) - return false; - if (wifiStatus != that.wifiStatus) - return false; - - return true; - } - - @Override - public int hashCode() { - return Arrays.hashCode(new Object[] { cellStatus, wifiStatus, elapsedRealtimeNanos }); - } - - private String statusToString(int status) { - switch (status) { - case STATUS_SUCCESSFUL: - return "STATUS_SUCCESSFUL"; - case STATUS_UNKNOWN: - default: - return "STATUS_UNKNOWN"; - case STATUS_TIMED_OUT_ON_SCAN: - return "STATUS_TIMED_OUT_ON_SCAN"; - case STATUS_NO_INFO_IN_DATABASE: - return "STATUS_NO_INFO_IN_DATABASE"; - case STATUS_INVALID_SCAN: - return "STATUS_INVALID_SCAN"; - case STATUS_UNABLE_TO_QUERY_DATABASE: - return "STATUS_UNABLE_TO_QUERY_DATABASE"; - case STATUS_SCANS_DISABLED_IN_SETTINGS: - return "STATUS_SCANS_DISABLED_IN_SETTINGS"; - case STATUS_LOCATION_DISABLED_IN_SETTINGS: - return "STATUS_LOCATION_DISABLED_IN_SETTINGS"; - case STATUS_IN_PROGRESS: - return "STATUS_IN_PROGRESS"; - } - } - - public static final Creator CREATOR = new AutoCreator(LocationStatus.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/internal/ClientIdentity.java b/play-services-location-api/src/main/java/com/google/android/gms/location/internal/ClientIdentity.java deleted file mode 100644 index a92c6516..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/internal/ClientIdentity.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location.internal; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class ClientIdentity extends AutoSafeParcelable { - public static final Creator CREATOR = new AutoCreator(ClientIdentity.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/internal/FusedLocationProviderResult.java b/play-services-location-api/src/main/java/com/google/android/gms/location/internal/FusedLocationProviderResult.java deleted file mode 100644 index b4b6516d..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/internal/FusedLocationProviderResult.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location.internal; - -import com.google.android.gms.common.api.Status; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class FusedLocationProviderResult extends AutoSafeParcelable { - public static final FusedLocationProviderResult SUCCESS = FusedLocationProviderResult.create(Status.SUCCESS); - - @SafeParceled(1000) - private int versionCode = 1; - - @SafeParceled(1) - public Status status; - - public static FusedLocationProviderResult create(Status status) { - FusedLocationProviderResult result = new FusedLocationProviderResult(); - result.status = status; - return result; - } - - public static final Creator CREATOR = new AutoCreator(FusedLocationProviderResult.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/internal/LocationRequestInternal.java b/play-services-location-api/src/main/java/com/google/android/gms/location/internal/LocationRequestInternal.java deleted file mode 100644 index c803a841..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/internal/LocationRequestInternal.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location.internal; - -import com.google.android.gms.location.LocationRequest; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -import java.util.List; - -public class LocationRequestInternal extends AutoSafeParcelable { - - @SafeParceled(1000) - private int versionCode = 1; - - @SafeParceled(1) - public LocationRequest request; - - @SafeParceled(2) - public boolean requestNlpDebugInfo; - - @SafeParceled(3) - public boolean restorePendingIntentListeners; - - @SafeParceled(4) - public boolean triggerUpdate; - - @SafeParceled(value = 5, subClass = ClientIdentity.class) - public List clients; - - @SafeParceled(6) - public String tag; - - @SafeParceled(7) - public boolean hideFromAppOps; - - @SafeParceled(8) - public boolean forceCoarseLocation; - - @Override - public String toString() { - return "LocationRequestInternal{" + - "request=" + request + - ", requestNlpDebugInfo=" + requestNlpDebugInfo + - ", restorePendingIntentListeners=" + restorePendingIntentListeners + - ", triggerUpdate=" + triggerUpdate + - ", clients=" + clients + - ", tag='" + tag + '\'' + - ", hideFromAppOps=" + hideFromAppOps + - ", forceCoarseLocation=" + forceCoarseLocation + - '}'; - } - - public static final Creator CREATOR = new AutoCreator(LocationRequestInternal.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/internal/LocationRequestUpdateData.java b/play-services-location-api/src/main/java/com/google/android/gms/location/internal/LocationRequestUpdateData.java deleted file mode 100644 index 6da81cc3..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/internal/LocationRequestUpdateData.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location.internal; - -import android.app.PendingIntent; - -import com.google.android.gms.location.ILocationCallback; -import com.google.android.gms.location.ILocationListener; -import com.google.android.gms.location.internal.IFusedLocationProviderCallback; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class LocationRequestUpdateData extends AutoSafeParcelable { - - public static final int REQUEST_UPDATES = 1; - public static final int REMOVE_UPDATES = 2; - - @SafeParceled(1000) - private int versionCode; - - @SafeParceled(1) - public int opCode; - - @SafeParceled(2) - public LocationRequestInternal request; - - @SafeParceled(3) - public ILocationListener listener; - - @SafeParceled(4) - public PendingIntent pendingIntent; - - @SafeParceled(5) - public ILocationCallback callback; - - @SafeParceled(6) - public IFusedLocationProviderCallback fusedLocationProviderCallback; - - @Override - public String toString() { - return "LocationRequestUpdateData{" + - "opCode=" + opCode + - ", request=" + request + - ", listener=" + (listener != null ? listener.asBinder() : null) + - ", pendingIntent=" + pendingIntent + - ", callback=" + (callback != null ? callback.asBinder() : null) + - ", fusedLocationProviderCallback=" + (fusedLocationProviderCallback != null ? fusedLocationProviderCallback.asBinder() : null) + - '}'; - } - - public static final Creator CREATOR = new AutoCreator(LocationRequestUpdateData.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/internal/ParcelableGeofence.java b/play-services-location-api/src/main/java/com/google/android/gms/location/internal/ParcelableGeofence.java deleted file mode 100644 index 3abc611c..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/internal/ParcelableGeofence.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2017 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.location.internal; - -import com.google.android.gms.location.Geofence; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class ParcelableGeofence extends AutoSafeParcelable implements Geofence { - - @SafeParceled(1000) - private int versionCode = 1; - - @SafeParceled(1) - public String requestId; - - @SafeParceled(2) - public long expirationTime; - - @SafeParceled(3) - public int regionType; - - @SafeParceled(4) - public double latitude; - - @SafeParceled(5) - public double longitude; - - @SafeParceled(6) - public float radius; - - @SafeParceled(7) - public int transitionType; - - @SafeParceled(8) - public int notificationResponsiveness; - - @SafeParceled(9) - public int loiteringDelay; - - private ParcelableGeofence() { - } - - public ParcelableGeofence(String requestId, long expirationTime, int regionType, double latitude, double longitude, float radius, int transitionType, int notificationResponsiveness, int loiteringDelay) { - this.requestId = requestId; - this.expirationTime = expirationTime; - this.regionType = regionType; - this.latitude = latitude; - this.longitude = longitude; - this.radius = radius; - this.transitionType = transitionType; - this.notificationResponsiveness = notificationResponsiveness; - this.loiteringDelay = loiteringDelay; - } - - @Override - public String getRequestId() { - return requestId; - } - - public static final Creator CREATOR = new AutoCreator(ParcelableGeofence.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/places/AutocompleteFilter.java b/play-services-location-api/src/main/java/com/google/android/gms/location/places/AutocompleteFilter.java deleted file mode 100644 index cf0f9238..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/places/AutocompleteFilter.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location.places; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -/** - * TODO usage - */ -public class AutocompleteFilter extends AutoSafeParcelable { - - @SafeParceled(1000) - private int versionCode = 1; - - public static final Creator CREATOR = new AutoCreator(AutocompleteFilter.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/places/NearbyAlertRequest.java b/play-services-location-api/src/main/java/com/google/android/gms/location/places/NearbyAlertRequest.java deleted file mode 100644 index 97c7b7e8..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/places/NearbyAlertRequest.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location.places; - -import org.microg.safeparcel.AutoSafeParcelable; - -/** - * TODO: usage - */ -public class NearbyAlertRequest extends AutoSafeParcelable { - - public static final Creator CREATOR = new AutoCreator(NearbyAlertRequest.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/places/Place.java b/play-services-location-api/src/main/java/com/google/android/gms/location/places/Place.java deleted file mode 100644 index 25ad8f3f..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/places/Place.java +++ /dev/null @@ -1,384 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location.places; - -import android.net.Uri; - -import com.google.android.gms.common.data.Freezable; -import com.google.android.gms.maps.model.LatLng; -import com.google.android.gms.maps.model.LatLngBounds; - -import java.util.List; -import java.util.Locale; - -public interface Place extends Freezable { - int TYPE_ACCOUNTING = 1; - - int TYPE_ADMINISTRATIVE_AREA_LEVEL_1 = 1001; - - int TYPE_ADMINISTRATIVE_AREA_LEVEL_2 = 1002; - - int TYPE_ADMINISTRATIVE_AREA_LEVEL_3 = 1003; - - int TYPE_AIRPORT = 2; - - int TYPE_AMUSEMENT_PARK = 3; - - int TYPE_AQUARIUM = 4; - - int TYPE_ART_GALLERY = 5; - - int TYPE_ATM = 6; - - int TYPE_BAKERY = 7; - - int TYPE_BANK = 8; - - int TYPE_BAR = 9; - - int TYPE_BEAUTY_SALON = 10; - - int TYPE_BICYCLE_STORE = 11; - - int TYPE_BOOK_STORE = 12; - - int TYPE_BOWLING_ALLEY = 13; - - int TYPE_BUS_STATION = 14; - - int TYPE_CAFE = 15; - - int TYPE_CAMPGROUND = 16; - - int TYPE_CAR_DEALER = 17; - - int TYPE_CAR_RENTAL = 18; - - int TYPE_CAR_REPAIR = 19; - - int TYPE_CAR_WASH = 20; - - int TYPE_CASINO = 21; - - int TYPE_CEMETERY = 22; - - int TYPE_CHURCH = 23; - - int TYPE_CITY_HALL = 24; - - int TYPE_CLOTHING_STORE = 25; - - int TYPE_COLLOQUIAL_AREA = 1004; - - int TYPE_CONVENIENCE_STORE = 26; - - int TYPE_COUNTRY = 1005; - - int TYPE_COURTHOUSE = 27; - - int TYPE_DENTIST = 28; - - int TYPE_DEPARTMENT_STORE = 29; - - int TYPE_DOCTOR = 30; - - int TYPE_ELECTRICIAN = 31; - - int TYPE_ELECTRONICS_STORE = 32; - - int TYPE_EMBASSY = 33; - - int TYPE_ESTABLISHMENT = 34; - - int TYPE_FINANCE = 35; - - int TYPE_FIRE_STATION = 36; - - int TYPE_FLOOR = 1006; - - int TYPE_FLORIST = 37; - - int TYPE_FOOD = 38; - - int TYPE_FUNERAL_HOME = 39; - - int TYPE_FURNITURE_STORE = 40; - - int TYPE_GAS_STATION = 41; - - int TYPE_GENERAL_CONTRACTOR = 42; - - int TYPE_GEOCODE = 1007; - - int TYPE_GROCERY_OR_SUPERMARKET = 43; - - int TYPE_GYM = 44; - - int TYPE_HAIR_CARE = 45; - - int TYPE_HARDWARE_STORE = 46; - - int TYPE_HEALTH = 47; - - int TYPE_HINDU_TEMPLE = 48; - - int TYPE_HOME_GOODS_STORE = 49; - - int TYPE_HOSPITAL = 50; - - int TYPE_INSURANCE_AGENCY = 51; - - int TYPE_INTERSECTION = 1008; - - int TYPE_JEWELRY_STORE = 52; - - int TYPE_LAUNDRY = 53; - - int TYPE_LAWYER = 54; - - int TYPE_LIBRARY = 55; - - int TYPE_LIQUOR_STORE = 56; - - int TYPE_LOCALITY = 1009; - - int TYPE_LOCAL_GOVERNMENT_OFFICE = 57; - - int TYPE_LOCKSMITH = 58; - - int TYPE_LODGING = 59; - - int TYPE_MEAL_DELIVERY = 60; - - int TYPE_MEAL_TAKEAWAY = 61; - - int TYPE_MOSQUE = 62; - - int TYPE_MOVIE_RENTAL = 63; - - int TYPE_MOVIE_THEATER = 64; - - int TYPE_MOVING_COMPANY = 65; - - int TYPE_MUSEUM = 66; - - int TYPE_NATURAL_FEATURE = 1010; - - int TYPE_NEIGHBORHOOD = 1011; - - int TYPE_NIGHT_CLUB = 67; - - int TYPE_OTHER = 0; - - int TYPE_PAINTER = 68; - - int TYPE_PARK = 69; - - int TYPE_PARKING = 70; - - int TYPE_PET_STORE = 71; - - int TYPE_PHARMACY = 72; - - int TYPE_PHYSIOTHERAPIST = 73; - - int TYPE_PLACE_OF_WORSHIP = 74; - - int TYPE_PLUMBER = 75; - - int TYPE_POINT_OF_INTEREST = 1013; - - int TYPE_POLICE = 76; - - int TYPE_POLITICAL = 1012; - - int TYPE_POSTAL_CODE = 1015; - - int TYPE_POSTAL_CODE_PREFIX = 1016; - - int TYPE_POSTAL_TOWN = 1017; - - int TYPE_POST_BOX = 1014; - - int TYPE_POST_OFFICE = 77; - - int TYPE_PREMISE = 1018; - - int TYPE_REAL_ESTATE_AGENCY = 78; - - int TYPE_RESTAURANT = 79; - - int TYPE_ROOFING_CONTRACTOR = 80; - - int TYPE_ROOM = 1019; - - int TYPE_ROUTE = 1020; - - int TYPE_RV_PARK = 81; - - int TYPE_SCHOOL = 82; - - int TYPE_SHOE_STORE = 83; - - int TYPE_SHOPPING_MALL = 84; - - int TYPE_SPA = 85; - - int TYPE_STADIUM = 86; - - int TYPE_STORAGE = 87; - - int TYPE_STORE = 88; - - int TYPE_STREET_ADDRESS = 1021; - - int TYPE_SUBLOCALITY = 1022; - - int TYPE_SUBLOCALITY_LEVEL_1 = 1023; - - int TYPE_SUBLOCALITY_LEVEL_2 = 1024; - - int TYPE_SUBLOCALITY_LEVEL_3 = 1025; - - int TYPE_SUBLOCALITY_LEVEL_4 = 1026; - - int TYPE_SUBLOCALITY_LEVEL_5 = 1027; - - int TYPE_SUBPREMISE = 1028; - - int TYPE_SUBWAY_STATION = 89; - - int TYPE_SYNAGOGUE = 90; - - int TYPE_SYNTHETIC_GEOCODE = 1029; - - int TYPE_TAXI_STAND = 91; - - int TYPE_TRAIN_STATION = 92; - - int TYPE_TRANSIT_STATION = 1030; - - int TYPE_TRAVEL_AGENCY = 93; - - int TYPE_UNIVERSITY = 94; - - int TYPE_VETERINARY_CARE = 95; - - int TYPE_ZOO = 96; - - /** - * Returns a human readable address for this Place. May return null if the address is unknown. - *

- * The address is localized according to the locale returned by {@link com.google.android.gms.location.places.Place#getLocale()}. - */ - CharSequence getAddress(); - - /** - * Returns the attributions to be shown to the user if data from the {@link com.google.android.gms.location.places.Place} is used. - *

- * We recommend placing this information below any place information. See - * Displaying Attributions for more details. - * - * @return The attributions in HTML format, or null if there are no attributions to display. - */ - CharSequence getAttributions(); - - /** - * Returns the unique id of this Place. - *

- * This ID can be passed to {@link com.google.android.gms.location.places.GeoDataApi#getPlaceById(com.google.android.gms.common.api.GoogleApiClient, java.lang.String...)} to lookup the same place at a later - * time, but it is not guaranteed that such a lookup will succeed (the place may no longer exist - * in our database). It is possible that the returned Place in such a lookup will have a - * different ID (so there may be multiple ID's for one given place). - */ - String getId(); - - /** - * Returns the location of this Place. - *

- * The location is not necessarily the center of the Place, or any particular entry or exit - * point, but some arbitrarily chosen point within the geographic extent of the Place. - */ - LatLng getLatLng(); - - /** - * Returns the locale in which the names and addresses were localized. - */ - Locale getLocale(); - - /** - * Returns the name of this Place. - *

- * The name is localized according to the locale returned by {@link com.google.android.gms.location.places.Place#getLocale()}. - */ - CharSequence getName(); - - /** - * Returns the place's phone number in international format. Returns null if no phone number is - * known, or the place has no phone number. - *

- * International format includes the country code, and is prefixed with the plus (+) sign. For - * example, the international phone number for Google's Mountain View, USA office is +1 - * 650-253-0000. - */ - CharSequence getPhoneNumber(); - - /** - * Returns a list of place types for this Place. - *

- * The elements of this list are drawn from Place.TYPE_* constants, though one should - * expect there could be new place types returned that were introduced after an app was - * published. - */ - List getPlaceTypes(); - - /** - * Returns the price level for this place on a scale from 0 (cheapest) to 4. - *

- * If no price level is known, a negative value is returned. - *

- * The price level of the place, on a scale of 0 to 4. The exact amount indicated by a specific - * value will vary from region to region. Price levels are interpreted as follows: - */ - int getPriceLevel(); - - /** - * Returns the place's rating, from 1.0 to 5.0, based on aggregated user reviews. - *

- * If no rating is known, a negative value is returned. - */ - float getRating(); - - /** - * Returns a viewport for displaying this Place. May return null if the size of the place is not - * known. - *

- * This returns a viewport of a size that is suitable for displaying this Place. For example, a - * Place representing a store may have a relatively small viewport, while a Place representing a - * country may have a very large viewport. - */ - LatLngBounds getViewport(); - - /** - * Returns the URI of the website of this Place. Returns null if no website is known. - *

- * This is the URI of the website maintained by the Place, if available. Note this is a - * third-party website not affiliated with the Places API. - */ - Uri getWebsiteUri(); - -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceFilter.java b/play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceFilter.java deleted file mode 100644 index 22bffb6b..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceFilter.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location.places; - -import org.microg.safeparcel.AutoSafeParcelable; - -/** - * TODO: usage - */ -public class PlaceFilter extends AutoSafeParcelable { - - public static final Creator CREATOR = new AutoCreator(PlaceFilter.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceReport.java b/play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceReport.java deleted file mode 100644 index 5919e691..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceReport.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location.places; - -import org.microg.gms.common.PublicApi; -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -@PublicApi -public class PlaceReport extends AutoSafeParcelable { - @SafeParceled(1) - private int versionCode; - @SafeParceled(2) - private String placeId; - @SafeParceled(3) - private String tag; - @SafeParceled(4) - private String source; - - public String getPlaceId() { - return placeId; - } - - public String getTag() { - return tag; - } - - public static final Creator CREATOR = new AutoCreator(PlaceReport.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceRequest.java b/play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceRequest.java deleted file mode 100644 index ed6a8556..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceRequest.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location.places; - -import org.microg.safeparcel.AutoSafeParcelable; - -/** - * TODO: usage - */ -public class PlaceRequest extends AutoSafeParcelable { - public static final Creator CREATOR = new AutoCreator(PlaceRequest.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/places/UserAddedPlace.java b/play-services-location-api/src/main/java/com/google/android/gms/location/places/UserAddedPlace.java deleted file mode 100644 index eb916696..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/places/UserAddedPlace.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location.places; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -/** - * TODO: usage - */ -public class UserAddedPlace extends AutoSafeParcelable { - - @SafeParceled(1000) - private int versionCode = 1; - - public static final Creator CREATOR = new AutoCreator(UserAddedPlace.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/places/UserDataType.java b/play-services-location-api/src/main/java/com/google/android/gms/location/places/UserDataType.java deleted file mode 100644 index 2e8776fd..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/places/UserDataType.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location.places; - -import org.microg.safeparcel.AutoSafeParcelable; - -/** - * TODO: usage - */ -public class UserDataType extends AutoSafeParcelable { - - public static final Creator CREATOR = new AutoCreator(UserDataType.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/places/internal/PlaceImpl.java b/play-services-location-api/src/main/java/com/google/android/gms/location/places/internal/PlaceImpl.java deleted file mode 100644 index dbc23035..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/places/internal/PlaceImpl.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location.places.internal; - -import android.net.Uri; -import android.os.Bundle; - -import com.google.android.gms.location.places.Place; -import com.google.android.gms.maps.model.LatLng; -import com.google.android.gms.maps.model.LatLngBounds; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Locale; - -public class PlaceImpl extends AutoSafeParcelable implements Place { - @SafeParceled(1000) - private int versionCode = 2; - @SafeParceled(1) - public String id; - @SafeParceled(2) - public Bundle addressComponents; - @SafeParceled(4) - public LatLng latLng; - @SafeParceled(5) - public float levelNumber; - @SafeParceled(6) - public LatLngBounds viewport; - @SafeParceled(7) - public String timezoneId; - @SafeParceled(8) - public Uri websiteUri; - @SafeParceled(9) - public boolean isPermanentlyClosed; - @SafeParceled(10) - public float rating; - @SafeParceled(11) - public int priceLevel; - @SafeParceled(12) - public long timestampSecs; - @SafeParceled(value = 13, subClass = Integer.class) - public List typesDeprecated = new ArrayList(); - @SafeParceled(14) - public String address; - @SafeParceled(15) - public String phoneNumber; - @SafeParceled(16) - public String regularOpenHours; - @SafeParceled(value = 17, subClass = String.class) - public List attributions = new ArrayList(); - @SafeParceled(19) - public String name; - @SafeParceled(value = 20, subClass = Integer.class) - public List placeTypes = new ArrayList(); - - @Override - public CharSequence getAddress() { - return address; - } - - @Override - public CharSequence getAttributions() { - return Arrays.toString(attributions.toArray()); - } - - @Override - public String getId() { - return id; - } - - @Override - public LatLng getLatLng() { - return latLng; - } - - @Override - public Locale getLocale() { - return Locale.getDefault(); - } - - @Override - public CharSequence getName() { - return name; - } - - @Override - public CharSequence getPhoneNumber() { - return phoneNumber; - } - - @Override - public List getPlaceTypes() { - return placeTypes; - } - - @Override - public int getPriceLevel() { - return priceLevel; - } - - @Override - public float getRating() { - return rating; - } - - @Override - public LatLngBounds getViewport() { - return viewport; - } - - @Override - public Uri getWebsiteUri() { - return websiteUri; - } - - @Override - public Place freeze() { - return this; - } - - @Override - public boolean isDataValid() { - return true; - } - - public static final Creator CREATOR = new AutoSafeParcelable.AutoCreator(PlaceImpl.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/places/internal/PlacesParams.java b/play-services-location-api/src/main/java/com/google/android/gms/location/places/internal/PlacesParams.java deleted file mode 100644 index eb365fa3..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/places/internal/PlacesParams.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location.places.internal; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class PlacesParams extends AutoSafeParcelable { - - @SafeParceled(1000) - private int versionCode = 1; - @SafeParceled(1) - public final String clientPackageName; - @SafeParceled(2) - public final String locale; - @SafeParceled(3) - public final String accountName; - @SafeParceled(4) - public final String gCoreClientName; - - private PlacesParams() { - clientPackageName = locale = accountName = gCoreClientName = null; - } - - public static final Creator CREATOR = new AutoCreator(PlacesParams.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/reporting/ReportingState.java b/play-services-location-api/src/main/java/com/google/android/gms/location/reporting/ReportingState.java deleted file mode 100644 index 1a223471..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/reporting/ReportingState.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location.reporting; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class ReportingState extends AutoSafeParcelable { - @SafeParceled(1) - public int versionCode = 2; - @SafeParceled(2) - public int reportingEnabled; - @SafeParceled(3) - public int historyEnabled; - @SafeParceled(4) - public boolean allowed; - @SafeParceled(5) - public boolean active; - @SafeParceled(6) - public boolean defer; - @SafeParceled(7) - public int expectedOptInResult; - @SafeParceled(8) - public Integer deviceTag; - @SafeParceled(9) - public int expectedOptInResultAssumingLocationEnabled; - - public static final Creator CREATOR = new AutoCreator(ReportingState.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/reporting/UploadRequest.java b/play-services-location-api/src/main/java/com/google/android/gms/location/reporting/UploadRequest.java deleted file mode 100644 index d3896f3c..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/reporting/UploadRequest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location.reporting; - -import android.accounts.Account; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class UploadRequest extends AutoSafeParcelable { - @SafeParceled(1) - public int versionCode = 1; - @SafeParceled(2) - public Account account; - @SafeParceled(3) - public String reason; - @SafeParceled(4) - public long durationMillis; - @SafeParceled(5) - public long movingLatencyMillis; - @SafeParceled(6) - public long stationaryLatencyMillis; - @SafeParceled(7) - public String appSpecificKey; - - public static final Creator CREATOR = new AutoCreator(UploadRequest.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/reporting/UploadRequestResult.java b/play-services-location-api/src/main/java/com/google/android/gms/location/reporting/UploadRequestResult.java deleted file mode 100644 index 2937a81c..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/reporting/UploadRequestResult.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location.reporting; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class UploadRequestResult extends AutoSafeParcelable { - @SafeParceled(1) - public int versionCode = 1; - @SafeParceled(2) - public int resultCode; - @SafeParceled(3) - public long requestId; - - public UploadRequestResult() { - } - - public static final Creator CREATOR = new AutoCreator(UploadRequestResult.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/maps/model/LatLng.java b/play-services-location-api/src/main/java/com/google/android/gms/maps/model/LatLng.java deleted file mode 100644 index 545d8b46..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/maps/model/LatLng.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.model; - -import org.microg.gms.common.PublicApi; -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -/** - * An immutable class representing a pair of latitude and longitude coordinates, stored as degrees. - */ -@PublicApi -public final class LatLng extends AutoSafeParcelable { - @SafeParceled(1) - private int versionCode = 1; - /** - * Latitude, in degrees. This value is in the range [-90, 90]. - */ - @SafeParceled(2) - public final double latitude; - /** - * Longitude, in degrees. This value is in the range [-180, 180). - */ - @SafeParceled(3) - public final double longitude; - - /** - * This constructor is dirty setting the final fields to make the compiler happy. - * In fact, those are replaced by their real values later using SafeParcelUtil. - */ - private LatLng() { - latitude = longitude = 0; - } - - /** - * Constructs a LatLng with the given latitude and longitude, measured in degrees. - * - * @param latitude The point's latitude. This will be clamped to between -90 degrees and - * +90 degrees inclusive. - * @param longitude The point's longitude. This will be normalized to be within -180 degrees - * inclusive and +180 degrees exclusive. - */ - public LatLng(double latitude, double longitude) { - this.latitude = Math.max(-90, Math.min(90, latitude)); - if ((-180 <= longitude) && (longitude < 180)) { - this.longitude = longitude; - } else { - this.longitude = ((360 + (longitude - 180) % 360) % 360 - 180); - } - } - - /** - * Tests if this LatLng is equal to another. - *

- * Two points are considered equal if and only if their latitudes are bitwise equal and their - * longitudes are bitwise equal. This means that two {@link LatLng}s that are very near, in - * terms of geometric distance, might not be considered {@code .equal()}. - */ - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - - LatLng latLng = (LatLng) o; - - if (Double.compare(latLng.latitude, latitude) != 0) - return false; - if (Double.compare(latLng.longitude, longitude) != 0) - return false; - - return true; - } - - @Override - public final int hashCode() { - long tmp1 = Double.doubleToLongBits(latitude); - int tmp2 = 31 + (int) (tmp1 ^ tmp1 >>> 32); - tmp1 = Double.doubleToLongBits(longitude); - return tmp2 * 31 + (int) (tmp1 ^ tmp1 >>> 32); - } - - @Override - public String toString() { - return "lat/lng: (" + latitude + "," + longitude + ")"; - } - - public static Creator CREATOR = new AutoCreator(LatLng.class); -} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/maps/model/LatLngBounds.java b/play-services-location-api/src/main/java/com/google/android/gms/maps/model/LatLngBounds.java deleted file mode 100644 index 21177235..00000000 --- a/play-services-location-api/src/main/java/com/google/android/gms/maps/model/LatLngBounds.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.model; - -import org.microg.gms.common.PublicApi; -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -import java.util.Arrays; - -/** - * An immutable class representing a latitude/longitude aligned rectangle. - */ -@PublicApi -public final class LatLngBounds extends AutoSafeParcelable { - @SafeParceled(1) - private int versionCode = 1; - /** - * Southwest corner of the bound. - */ - @SafeParceled(2) - public final LatLng southwest; - /** - * Northeast corner of the bound. - */ - @SafeParceled(3) - public final LatLng northeast; - - /** - * This constructor is dirty setting the final fields to make the compiler happy. - * In fact, those are replaced by their real values later using SafeParcelUtil. - */ - private LatLngBounds() { - southwest = northeast = null; - } - - /** - * Creates a new bounds based on a southwest and a northeast corner. - *

- * The bounds conceptually includes all points where: - *

- * - * @param southwest southwest corner - * @param northeast northeast corner - * @throws IllegalArgumentException if the latitude of the northeast corner is below the - * latitude of the southwest corner. - */ - public LatLngBounds(LatLng southwest, LatLng northeast) throws IllegalArgumentException { - if (northeast.latitude < southwest.latitude) - throw new IllegalArgumentException("latitude of northeast corner must not be" + - " lower than latitude of southwest corner"); - this.southwest = southwest; - this.northeast = northeast; - } - - /** - * Creates a new builder. - */ - public Builder builder() { - return new Builder(); - } - - /** - * Returns whether this contains the given {@link LatLng}. - * - * @param point the {@link LatLng} to test - * @return {@code true} if this contains the given point; {@code false} if not. - */ - public boolean contains(LatLng point) { - return containsLatitude(point.latitude) && containsLongitude(point.longitude); - } - - private boolean containsLatitude(double latitude) { - return southwest.latitude <= latitude && latitude <= northeast.latitude; - } - - private boolean containsLongitude(double longitude) { - return southwest.longitude <= northeast.longitude ? ( - southwest.longitude <= longitude && longitude <= northeast.longitude - ) : ( - southwest.longitude >= longitude && longitude < 180 || - longitude >= -180 && longitude <= northeast.longitude - ); - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - - LatLngBounds that = (LatLngBounds) o; - - if (!northeast.equals(that.northeast)) - return false; - if (!southwest.equals(that.southwest)) - return false; - - return true; - } - - /** - * Returns the center of this {@link LatLngBounds}. The center is simply the average of the - * coordinates (taking into account if it crosses the antimeridian). This is approximately the - * geographical center (it would be exact if the Earth were a perfect sphere). It will not - * necessarily be the center of the rectangle as drawn on the map due to the Mercator - * projection. - * - * @return A {@link LatLng} that is the center of the {@link LatLngBounds}. - */ - public LatLng getCenter() { - double lat = (southwest.latitude + northeast.latitude) / 2.0; - double lon = (southwest.longitude + northeast.longitude) / 2.0 + - southwest.longitude <= northeast.latitude ? 0 : 180.0; - return new LatLng(lat, lon); - } - - @Override - public int hashCode() { - return Arrays.hashCode(new Object[] { southwest, northeast }); - } - - /** - * Returns a new {@link LatLngBounds} that extends this {@link LatLngBounds} to include the - * given {@link LatLng}. This will return the smallest LatLngBounds that contains both this - * and the extra point. - *

- * In particular, it will consider extending the bounds both in the eastward and westward - * directions (one of which may cross the antimeridian) and choose the smaller of the two. In - * the case that both directions result in a LatLngBounds of the same size, this will extend - * it in the eastward direction. - * - * @param point a {@link LatLng} to be included in the new bounds - * @return A new {@link LatLngBounds} that contains this and the extra point. - */ - public LatLngBounds including(LatLng point) { - double latMin = Math.min(southwest.latitude, point.latitude); - double latMax = Math.max(northeast.latitude, point.latitude); - double lonMin = southwest.longitude; - double lonMax = northeast.longitude; - if (!containsLongitude(point.longitude)) { - if ((southwest.longitude - point.longitude + 360.0) % 360.0 < - (point.longitude - northeast.longitude + 360.0D) % 360.0D) { - lonMin = point.longitude; - } else { - lonMax = point.longitude; - } - } - return new LatLngBounds(new LatLng(latMin, lonMin), new LatLng(latMax, lonMax)); - } - - @Override - public String toString() { - return "LatLngBounds{" + - "southwest=" + southwest + - ", northeast=" + northeast + - '}'; - } - - public static Creator CREATOR = new AutoCreator(LatLngBounds.class); - - /** - * This is a builder that is able to create a minimum bound based on a set of LatLng points. - */ - public static final class Builder { - private LatLngBounds bounds; - - public Builder() { - - } - - /** - * Creates the LatLng bounds. - * - * @throws IllegalStateException if no points have been included. - */ - public LatLngBounds build() throws IllegalStateException { - if (bounds == null) - throw new IllegalStateException( - "You must not call build() before adding points to the Builder"); - return bounds; - } - - /** - * Includes this point for building of the bounds. The bounds will be extended in a - * minimum way to include this point. - *

- * More precisely, it will consider extending the bounds both in the eastward and westward - * directions (one of which may cross the antimeridian) and choose the smaller of the two. - * In the case that both directions result in a LatLngBounds of the same size, this will - * extend it in the eastward direction. For example, adding points (0, -179) and (1, 179) - * will create a bound crossing the 180 longitude. - * - * @param point A {@link LatLng} to be included in the bounds. - * @return This builder object with a new point added. - */ - public Builder include(LatLng point) { - if (bounds == null) { - bounds = new LatLngBounds(point, point); - } else { - bounds = bounds.including(point); - } - return this; - } - } -} diff --git a/play-services-location-api/src/main/java/org/microg/gms/location/LocationConstants.java b/play-services-location-api/src/main/java/org/microg/gms/location/LocationConstants.java deleted file mode 100644 index fc256bc6..00000000 --- a/play-services-location-api/src/main/java/org/microg/gms/location/LocationConstants.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -public class LocationConstants { - public static final String KEY_MOCK_LOCATION = "mockLocation"; - - // Place picker client->service - public static final String EXTRA_PRIMARY_COLOR = "primary_color"; - public static final String EXTRA_PRIMARY_COLOR_DARK = "primary_color_dark"; - public static final String EXTRA_CLIENT_VERSION = "gmscore_client_jar_version"; - public static final String EXTRA_BOUNDS = "latlng_bounds"; - - // Place picker service->client - public static final String EXTRA_ATTRIBUTION = "third_party_attributions"; - public static final String EXTRA_FINAL_BOUNDS = "final_latlng_bounds"; - public static final String EXTRA_PLACE = "selected_place"; - public static final String EXTRA_STATUS = "status"; -} diff --git a/play-services-location-core/build.gradle b/play-services-location-core/build.gradle deleted file mode 100644 index 0556c781..00000000 --- a/play-services-location-core/build.gradle +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020, microG Project Team - * SPDX-License-Identifier: Apache-2.0 - */ - -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' - -dependencies { - api project(':play-services-location-api') - - implementation project(':play-services-base-core') - implementation "org.microg.nlp:geocode-v1:$nlpVersion" - implementation "org.microg.nlp:location-v2:$nlpVersion" - implementation "org.microg.nlp:location-v3:$nlpVersion" - implementation "org.microg.nlp:service:$nlpVersion" - implementation "org.microg.nlp:client:$nlpVersion" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutineVersion" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutineVersion" - api "org.microg.nlp:ui:$nlpVersion" -} - -android { - compileSdkVersion androidCompileSdk - buildToolsVersion "$androidBuildVersionTools" - - defaultConfig { - versionName version - minSdkVersion androidMinSdk - targetSdkVersion androidTargetSdk - } - - compileOptions { - sourceCompatibility = 1.8 - targetCompatibility = 1.8 - } -} diff --git a/play-services-location-core/src/main/AndroidManifest.xml b/play-services-location-core/src/main/AndroidManifest.xml deleted file mode 100644 index 4786a8e7..00000000 --- a/play-services-location-core/src/main/AndroidManifest.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/play-services-location-core/src/main/java/org/microg/gms/location/GoogleLocationManager.java b/play-services-location-core/src/main/java/org/microg/gms/location/GoogleLocationManager.java deleted file mode 100644 index ae767666..00000000 --- a/play-services-location-core/src/main/java/org/microg/gms/location/GoogleLocationManager.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.Manifest; -import android.app.PendingIntent; -import android.content.Context; -import android.location.Location; -import android.location.LocationManager; -import android.os.Binder; -import android.os.RemoteException; - -import com.google.android.gms.location.ILocationListener; -import com.google.android.gms.location.LocationRequest; -import com.google.android.gms.location.internal.FusedLocationProviderResult; -import com.google.android.gms.location.internal.LocationRequestUpdateData; - -import org.microg.gms.common.PackageUtils; -import org.microg.gms.common.Utils; - -import java.util.ArrayList; -import java.util.List; - -import static android.Manifest.permission.ACCESS_COARSE_LOCATION; -import static android.Manifest.permission.ACCESS_FINE_LOCATION; -import static android.content.pm.PackageManager.PERMISSION_GRANTED; -import static android.location.LocationManager.GPS_PROVIDER; -import static android.location.LocationManager.NETWORK_PROVIDER; -import static com.google.android.gms.location.LocationRequest.PRIORITY_HIGH_ACCURACY; -import static com.google.android.gms.location.LocationRequest.PRIORITY_NO_POWER; - -public class GoogleLocationManager implements LocationChangeListener { - private static final String TAG = "GmsLocManager"; - private static final String MOCK_PROVIDER = "mock"; - private static final long SWITCH_ON_FRESHNESS_CLIFF_MS = 30000; // 30 seconds - private static final String ACCESS_MOCK_LOCATION = "android.permission.ACCESS_MOCK_LOCATION"; - - private final Context context; - private final RealLocationProvider gpsProvider; - private final UnifiedLocationProvider networkProvider; - private final MockLocationProvider mockProvider; - private final List currentRequests = new ArrayList(); - - public GoogleLocationManager(Context context) { - this.context = context; - LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); - if (Utils.hasSelfPermissionOrNotify(context, Manifest.permission.ACCESS_FINE_LOCATION)) { - this.gpsProvider = new RealLocationProvider(locationManager, GPS_PROVIDER, this); - } else { - this.gpsProvider = null; - } - if (Utils.hasSelfPermissionOrNotify(context, Manifest.permission.ACCESS_COARSE_LOCATION)) { - if (locationManager.getAllProviders().contains(NETWORK_PROVIDER)) { - this.networkProvider = new UnifiedLocationProvider(context, this); - } else { - // TODO: Add ability to directly contact UnifiedNlp without the system location provider - this.networkProvider = null; - } - } else { - this.networkProvider = null; - } - mockProvider = new MockLocationProvider(this); - } - - public Location getLastLocation(String packageName) { - return getLocation(hasFineLocationPermission(), hasCoarseLocationPermission()); - } - - public Location getLocation(boolean gpsPermission, boolean networkPermission) { - if (mockProvider.getLocation() != null) - return mockProvider.getLocation(); - if (gpsPermission) { - Location network = networkProvider == null ? null : networkProvider.getLastLocation(); - Location gps = gpsProvider == null ? null : gpsProvider.getLastLocation(); - if (network == null) - return gps; - if (gps == null) - return network; - if (gps.getTime() > network.getTime() - SWITCH_ON_FRESHNESS_CLIFF_MS) - return gps; - return network; - } else if (networkPermission) { - Location network = networkProvider == null ? null : networkProvider.getLastLocation(); - if (network != null && network.getExtras() != null && network.getExtras().getParcelable("no_gps_location") instanceof Location) { - network = network.getExtras().getParcelable("no_gps_location"); - } - return network; - } - return null; - } - - private boolean hasCoarseLocationPermission() { - return context.checkCallingPermission(ACCESS_COARSE_LOCATION) == PERMISSION_GRANTED || hasFineLocationPermission(); - } - - private boolean hasFineLocationPermission() { - return context.checkCallingPermission(ACCESS_FINE_LOCATION) == PERMISSION_GRANTED; - } - - private boolean hasMockLocationPermission() { - return context.checkCallingPermission(ACCESS_MOCK_LOCATION) == PERMISSION_GRANTED; - } - - private void requestLocationUpdates(LocationRequestHelper request) { - LocationRequestHelper old = null; - for (LocationRequestHelper req : currentRequests) { - if (req.respondsTo(request.pendingIntent) || req.respondsTo(request.listener) || req.respondsTo(request.callback)) { - old = req; - break; - } - } - if (old != null) { - currentRequests.remove(old); - } - currentRequests.add(request); - if (gpsProvider != null && request.hasFinePermission() && request.locationRequest.getPriority() == PRIORITY_HIGH_ACCURACY) { - gpsProvider.addRequest(request); - } else if (gpsProvider != null && old != null) { - gpsProvider.removeRequest(old); - } - if (networkProvider != null && request.hasCoarsePermission() && request.locationRequest.getPriority() != PRIORITY_NO_POWER) { - networkProvider.addRequest(request); - } else if (networkProvider != null && old != null) { - networkProvider.removeRequest(old); - } - } - - public void requestLocationUpdates(LocationRequest request, ILocationListener listener, String packageName) { - requestLocationUpdates(new LocationRequestHelper(context, request, packageName, Binder.getCallingUid(), listener)); - } - - public void requestLocationUpdates(LocationRequest request, PendingIntent intent, String packageName) { - requestLocationUpdates(new LocationRequestHelper(context, request, packageName, Binder.getCallingUid(), intent)); - } - - private void removeLocationUpdates(LocationRequestHelper request) { - currentRequests.remove(request); - if (gpsProvider != null) gpsProvider.removeRequest(request); - if (networkProvider != null) networkProvider.removeRequest(request); - } - - public void removeLocationUpdates(ILocationListener listener, String packageName) { - for (int i = 0; i < currentRequests.size(); i++) { - if (currentRequests.get(i).respondsTo(listener)) { - removeLocationUpdates(currentRequests.get(i)); - i--; - } - } - } - - public void removeLocationUpdates(PendingIntent intent, String packageName) { - for (int i = 0; i < currentRequests.size(); i++) { - if (currentRequests.get(i).respondsTo(intent)) { - removeLocationUpdates(currentRequests.get(i)); - i--; - } - } - } - - public void updateLocationRequest(LocationRequestUpdateData data) { - String packageName = PackageUtils.getCallingPackage(context); - if (data.pendingIntent != null) - packageName = PackageUtils.packageFromPendingIntent(data.pendingIntent); - if (data.opCode == LocationRequestUpdateData.REQUEST_UPDATES) { - requestLocationUpdates(new LocationRequestHelper(context, packageName, Binder.getCallingUid(), data)); - } else if (data.opCode == LocationRequestUpdateData.REMOVE_UPDATES) { - for (int i = 0; i < currentRequests.size(); i++) { - if (currentRequests.get(i).respondsTo(data.listener) - || currentRequests.get(i).respondsTo(data.pendingIntent) - || currentRequests.get(i).respondsTo(data.callback)) { - removeLocationUpdates(currentRequests.get(i)); - i--; - } - } - } - if (data.fusedLocationProviderCallback != null) { - try { - data.fusedLocationProviderCallback.onFusedLocationProviderResult(FusedLocationProviderResult.SUCCESS); - } catch (RemoteException ignored) { - } - } - } - - public void setMockMode(boolean mockMode) { - if (!hasMockLocationPermission()) - return; - mockProvider.setMockEnabled(mockMode); - } - - public void setMockLocation(Location mockLocation) { - if (!hasMockLocationPermission()) - return; - mockProvider.setLocation(mockLocation); - } - - @Override - public void onLocationChanged() { - for (int i = 0; i < currentRequests.size(); i++) { - LocationRequestHelper request = currentRequests.get(i); - if (!request.report(getLocation(request.initialHasFinePermission, request.initialHasCoarsePermission))) { - removeLocationUpdates(request); - i--; - } - } - } -} diff --git a/play-services-location-core/src/main/java/org/microg/gms/location/GoogleLocationManagerService.java b/play-services-location-core/src/main/java/org/microg/gms/location/GoogleLocationManagerService.java deleted file mode 100644 index 1a105150..00000000 --- a/play-services-location-core/src/main/java/org/microg/gms/location/GoogleLocationManagerService.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.os.RemoteException; - -import com.google.android.gms.common.internal.GetServiceRequest; -import com.google.android.gms.common.internal.IGmsCallbacks; - -import org.microg.gms.BaseService; -import org.microg.gms.common.GmsService; - -public class GoogleLocationManagerService extends BaseService { - private GoogleLocationManagerServiceImpl impl = new GoogleLocationManagerServiceImpl(this); - - public GoogleLocationManagerService() { - super("GmsLocManagerSvc", GmsService.LOCATION_MANAGER, GmsService.GEODATA, GmsService.PLACE_DETECTION); - } - - @Override - public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException { - callback.onPostInitComplete(0, impl.asBinder(), null); - } -} diff --git a/play-services-location-core/src/main/java/org/microg/gms/location/GoogleLocationManagerServiceImpl.java b/play-services-location-core/src/main/java/org/microg/gms/location/GoogleLocationManagerServiceImpl.java deleted file mode 100644 index 31ac74a3..00000000 --- a/play-services-location-core/src/main/java/org/microg/gms/location/GoogleLocationManagerServiceImpl.java +++ /dev/null @@ -1,357 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.app.PendingIntent; -import android.content.Context; -import android.location.Location; -import android.os.Binder; -import android.os.IBinder; -import android.os.Parcel; -import android.os.RemoteException; -import android.util.Log; - -import com.google.android.gms.common.api.Status; -import com.google.android.gms.location.ActivityRecognitionResult; -import com.google.android.gms.location.GeofencingRequest; -import com.google.android.gms.location.GestureRequest; -import com.google.android.gms.location.ILocationListener; -import com.google.android.gms.location.LocationAvailability; -import com.google.android.gms.location.LocationRequest; -import com.google.android.gms.location.LocationSettingsRequest; -import com.google.android.gms.location.LocationSettingsResult; -import com.google.android.gms.location.LocationSettingsStates; -import com.google.android.gms.location.internal.IGeofencerCallbacks; -import com.google.android.gms.location.internal.IGoogleLocationManagerService; -import com.google.android.gms.location.internal.ISettingsCallbacks; -import com.google.android.gms.location.internal.LocationRequestInternal; -import com.google.android.gms.location.internal.LocationRequestUpdateData; -import com.google.android.gms.location.internal.ParcelableGeofence; -import com.google.android.gms.location.places.AutocompleteFilter; -import com.google.android.gms.location.places.NearbyAlertRequest; -import com.google.android.gms.location.places.PlaceFilter; -import com.google.android.gms.location.places.PlaceReport; -import com.google.android.gms.location.places.PlaceRequest; -import com.google.android.gms.location.places.UserAddedPlace; -import com.google.android.gms.location.places.UserDataType; -import com.google.android.gms.location.places.internal.IPlacesCallbacks; -import com.google.android.gms.location.places.internal.PlacesParams; -import com.google.android.gms.maps.model.LatLng; -import com.google.android.gms.maps.model.LatLngBounds; - -import org.microg.gms.common.PackageUtils; - -import java.util.Arrays; -import java.util.List; - -public class GoogleLocationManagerServiceImpl extends IGoogleLocationManagerService.Stub { - private static final String TAG = "GmsLocManagerSvcImpl"; - - private final Context context; - private GoogleLocationManager locationManager; - - public GoogleLocationManagerServiceImpl(Context context) { - this.context = context; - } - - private GoogleLocationManager getLocationManager() { - if (locationManager == null) - locationManager = new GoogleLocationManager(context); - return locationManager; - } - - @Override - public void addGeofencesList(List geofences, PendingIntent pendingIntent, - IGeofencerCallbacks callbacks, String packageName) throws RemoteException { - Log.d(TAG, "addGeofencesList: " + geofences); - PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid()); - } - - @Override - public void removeGeofencesByIntent(PendingIntent pendingIntent, IGeofencerCallbacks callbacks, - String packageName) throws RemoteException { - Log.d(TAG, "removeGeofencesByIntent: " + pendingIntent); - PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid()); - } - - @Override - public void removeGeofencesById(String[] geofenceRequestIds, IGeofencerCallbacks callbacks, - String packageName) throws RemoteException { - Log.d(TAG, "removeGeofencesById: " + Arrays.toString(geofenceRequestIds)); - PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid()); - } - - @Override - public void removeAllGeofences(IGeofencerCallbacks callbacks, String packageName) throws RemoteException { - Log.d(TAG, "removeAllGeofences"); - PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid()); - } - - @Override - public void requestActivityUpdates(long detectionIntervalMillis, boolean alwaysTrue, - PendingIntent callbackIntent) throws RemoteException { - Log.d(TAG, "requestActivityUpdates: " + callbackIntent); - } - - @Override - public void removeActivityUpdates(PendingIntent callbackIntent) throws RemoteException { - Log.d(TAG, "removeActivityUpdates: " + callbackIntent); - } - - @Override - public ActivityRecognitionResult getLastActivity(String packageName) throws RemoteException { - Log.d(TAG, "getLastActivity"); - PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid()); - return null; - } - - @Override - public Status iglms65(PendingIntent pendingIntent) throws RemoteException { - Log.d(TAG, "iglms65"); - return null; - } - - @Override - public Status iglms66(PendingIntent pendingIntent) throws RemoteException { - Log.d(TAG, "iglms66"); - return null; - } - - @Override - public Status requestGestureUpdates(GestureRequest request, PendingIntent pendingIntent) throws RemoteException { - Log.d(TAG, "requestGestureUpdates"); - return null; - } - - @Override - public Status iglms61(PendingIntent pendingIntent) throws RemoteException { - Log.d(TAG, "iglms61"); - return null; - } - - @Override - public Location getLastLocation() throws RemoteException { - Log.d(TAG, "getLastLocation"); - return getLocationManager().getLastLocation(PackageUtils.getCallingPackage(context)); - } - - @Override - public void requestLocationUpdatesWithListener(LocationRequest request, - final ILocationListener listener) throws RemoteException { - Log.d(TAG, "requestLocationUpdatesWithListener: " + request); - getLocationManager().requestLocationUpdates(request, listener, PackageUtils.getCallingPackage(context)); - } - - @Override - public void requestLocationUpdatesWithIntent(LocationRequest request, - PendingIntent callbackIntent) throws RemoteException { - Log.d(TAG, "requestLocationUpdatesWithIntent: " + request); - getLocationManager().requestLocationUpdates(request, callbackIntent, PackageUtils.packageFromPendingIntent(callbackIntent)); - } - - @Override - public void removeLocationUpdatesWithListener(ILocationListener listener) - throws RemoteException { - Log.d(TAG, "removeLocationUpdatesWithListener: " + listener); - getLocationManager().removeLocationUpdates(listener, PackageUtils.getCallingPackage(context)); - } - - @Override - public void removeLocationUpdatesWithIntent(PendingIntent callbackIntent) - throws RemoteException { - Log.d(TAG, "removeLocationUpdatesWithIntent: " + callbackIntent); - getLocationManager().removeLocationUpdates(callbackIntent, PackageUtils.packageFromPendingIntent(callbackIntent)); - } - - @Override - public void updateLocationRequest(LocationRequestUpdateData locationRequestUpdateData) throws RemoteException { - Log.d(TAG, "updateLocationRequest: " + locationRequestUpdateData); - getLocationManager().updateLocationRequest(locationRequestUpdateData); - } - - @Override - public void setMockMode(boolean mockMode) throws RemoteException { - Log.d(TAG, "setMockMode: " + mockMode); - getLocationManager().setMockMode(mockMode); - } - - @Override - public void setMockLocation(Location mockLocation) throws RemoteException { - Log.d(TAG, "setMockLocation: " + mockLocation); - getLocationManager().setMockLocation(mockLocation); - } - - @Override - public void iglms14(LatLngBounds var1, int var2, PlaceFilter var3, PlacesParams var4, - IPlacesCallbacks var5) throws RemoteException { - Log.d(TAG, "iglms14: " + var1); - } - - @Override - public void iglms15(String var1, PlacesParams var2, IPlacesCallbacks var3) - throws RemoteException { - Log.d(TAG, "iglms15: " + var1); - } - - @Override - public void iglms16(LatLng var1, PlaceFilter var2, PlacesParams var3, IPlacesCallbacks var4) - throws RemoteException { - Log.d(TAG, "iglms16: " + var1); - } - - @Override - public void iglms17(PlaceFilter var1, PlacesParams var2, IPlacesCallbacks var3) - throws RemoteException { - Log.d(TAG, "iglms17: " + var1); - } - - @Override - public void iglms18(PlaceRequest var1, PlacesParams var2, PendingIntent var3) - throws RemoteException { - Log.d(TAG, "iglms18: " + var1); - } - - @Override - public void iglms19(PlacesParams var1, PendingIntent var2) throws RemoteException { - Log.d(TAG, "iglms19: " + var1); - } - - @Override - public void requestLocationUpdatesWithPackage(LocationRequest request, ILocationListener listener, - String packageName) throws RemoteException { - Log.d(TAG, "requestLocationUpdatesWithPackage: " + request); - PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid()); - getLocationManager().requestLocationUpdates(request, listener, packageName); - } - - @Override - public Location getLastLocationWithPackage(String packageName) throws RemoteException { - Log.d(TAG, "getLastLocationWithPackage: " + packageName); - PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid()); - return getLocationManager().getLastLocation(packageName); - } - - @Override - public void iglms25(PlaceReport var1, PlacesParams var2) throws RemoteException { - Log.d(TAG, "iglms25: " + var1); - } - - @Override - public void iglms26(Location var1, int var2) throws RemoteException { - Log.d(TAG, "iglms26: " + var1); - } - - @Override - public LocationAvailability getLocationAvailabilityWithPackage(String packageName) throws RemoteException { - Log.d(TAG, "getLocationAvailabilityWithPackage: " + packageName); - PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid()); - return new LocationAvailability(); - } - - @Override - public void iglms42(String var1, PlacesParams var2, IPlacesCallbacks var3) - throws RemoteException { - Log.d(TAG, "iglms42: " + var1); - } - - @Override - public void iglms46(UserAddedPlace var1, PlacesParams var2, IPlacesCallbacks var3) - throws RemoteException { - Log.d(TAG, "iglms46: " + var1); - } - - @Override - public void iglms47(LatLngBounds var1, int var2, String var3, PlaceFilter var4, - PlacesParams var5, IPlacesCallbacks var6) throws RemoteException { - Log.d(TAG, "iglms47: " + var1); - } - - @Override - public void iglms48(NearbyAlertRequest var1, PlacesParams var2, PendingIntent var3) - throws RemoteException { - Log.d(TAG, "iglms48: " + var1); - } - - @Override - public void iglms49(PlacesParams var1, PendingIntent var2) throws RemoteException { - Log.d(TAG, "iglms49: " + var1); - } - - @Override - public void iglms50(UserDataType var1, LatLngBounds var2, List var3, PlacesParams var4, - IPlacesCallbacks var5) throws RemoteException { - Log.d(TAG, "iglms50: " + var1); - } - - @Override - public IBinder iglms51() throws RemoteException { - Log.d(TAG, "iglms51"); - return null; - } - - @Override - public void requestLocationSettingsDialog(LocationSettingsRequest settingsRequest, ISettingsCallbacks callback, String packageName) throws RemoteException { - Log.d(TAG, "requestLocationSettingsDialog: " + settingsRequest); - PackageUtils.getAndCheckCallingPackage(context, packageName); - callback.onLocationSettingsResult(new LocationSettingsResult(new LocationSettingsStates(true, true, false, true, true, false), Status.SUCCESS)); - } - - @Override - public void requestLocationUpdatesInternalWithListener(LocationRequestInternal request, - ILocationListener listener) throws RemoteException { - Log.d(TAG, "requestLocationUpdatesInternalWithListener: " + request); - getLocationManager().requestLocationUpdates(request.request, listener, PackageUtils.getCallingPackage(context)); - } - - @Override - public void requestLocationUpdatesInternalWithIntent(LocationRequestInternal request, - PendingIntent callbackIntent) throws RemoteException { - Log.d(TAG, "requestLocationUpdatesInternalWithIntent: " + request); - getLocationManager().requestLocationUpdates(request.request, callbackIntent, PackageUtils.packageFromPendingIntent(callbackIntent)); - } - - @Override - public IBinder iglms54() throws RemoteException { - Log.d(TAG, "iglms54"); - return null; - } - - @Override - public void iglms55(String var1, LatLngBounds var2, AutocompleteFilter var3, PlacesParams var4, - IPlacesCallbacks var5) throws RemoteException { - Log.d(TAG, "iglms55: " + var1); - } - - @Override - public void addGeofences(GeofencingRequest geofencingRequest, PendingIntent pendingIntent, - IGeofencerCallbacks callbacks) throws RemoteException { - Log.d(TAG, "addGeofences: " + geofencingRequest); - } - - @Override - public void iglms58(List var1, PlacesParams var2, IPlacesCallbacks var3) - throws RemoteException { - Log.d(TAG, "iglms58: " + var1); - } - - @Override - public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { - if (super.onTransact(code, data, reply, flags)) return true; - Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags); - return false; - } -} diff --git a/play-services-location-core/src/main/java/org/microg/gms/location/LocationChangeListener.java b/play-services-location-core/src/main/java/org/microg/gms/location/LocationChangeListener.java deleted file mode 100644 index f574746d..00000000 --- a/play-services-location-core/src/main/java/org/microg/gms/location/LocationChangeListener.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -public interface LocationChangeListener { - public void onLocationChanged(); -} diff --git a/play-services-location-core/src/main/java/org/microg/gms/location/LocationRequestHelper.java b/play-services-location-core/src/main/java/org/microg/gms/location/LocationRequestHelper.java deleted file mode 100644 index ad67ae31..00000000 --- a/play-services-location-core/src/main/java/org/microg/gms/location/LocationRequestHelper.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.annotation.TargetApi; -import android.app.ActivityManager; -import android.app.AppOpsManager; -import android.app.PendingIntent; -import android.content.Context; -import android.content.Intent; -import android.content.pm.PackageManager; -import android.location.Location; -import android.os.Binder; -import android.os.Build; -import android.os.RemoteException; -import android.util.Log; - -import com.google.android.gms.location.ILocationCallback; -import com.google.android.gms.location.ILocationListener; -import com.google.android.gms.location.LocationRequest; -import com.google.android.gms.location.LocationResult; -import com.google.android.gms.location.internal.LocationRequestUpdateData; - -import org.microg.gms.common.PackageUtils; - -import java.util.Arrays; -import java.util.List; - -import static android.Manifest.permission.ACCESS_BACKGROUND_LOCATION; -import static android.Manifest.permission.ACCESS_COARSE_LOCATION; -import static android.Manifest.permission.ACCESS_FINE_LOCATION; - -public class LocationRequestHelper { - public static final String TAG = "GmsLocRequestHelper"; - private final Context context; - public final LocationRequest locationRequest; - public final boolean initialHasFinePermission; - public final boolean initialHasCoarsePermission; - public final String packageName; - public final int uid; - private final boolean selfHasAppOpsRights; - public ILocationListener listener; - public PendingIntent pendingIntent; - public ILocationCallback callback; - - private Location lastReport; - private int numReports = 0; - - private LocationRequestHelper(Context context, LocationRequest locationRequest, String packageName, int uid) { - this.context = context; - this.locationRequest = locationRequest; - this.packageName = packageName; - this.uid = uid; - - this.initialHasFinePermission = context.getPackageManager().checkPermission(ACCESS_FINE_LOCATION, packageName) == PackageManager.PERMISSION_GRANTED; - this.initialHasCoarsePermission = context.getPackageManager().checkPermission(ACCESS_COARSE_LOCATION, packageName) == PackageManager.PERMISSION_GRANTED; - - this.selfHasAppOpsRights = context.getPackageManager().checkPermission("android.permission.UPDATE_APP_OPS_STATS", context.getPackageName()) == PackageManager.PERMISSION_GRANTED; - } - - public LocationRequestHelper(Context context, LocationRequest locationRequest, String packageName, int uid, ILocationListener listener) { - this(context, locationRequest, packageName, uid); - this.listener = listener; - } - - public LocationRequestHelper(Context context, LocationRequest locationRequest, String packageName, int uid, PendingIntent pendingIntent) { - this(context, locationRequest, packageName, uid); - this.pendingIntent = pendingIntent; - } - - public LocationRequestHelper(Context context, String packageName, int uid, LocationRequestUpdateData data) { - this(context, data.request.request, packageName, uid); - this.listener = data.listener; - this.pendingIntent = data.pendingIntent; - this.callback = data.callback; - } - - /** - * @return whether to continue sending reports to this {@link LocationRequestHelper} - */ - public boolean report(Location location) { - if (location == null) return true; - if (!hasCoarsePermission()) return false; - if (lastReport != null) { - if (location.getTime() - lastReport.getTime() < locationRequest.getFastestInterval()) { - return true; - } - if (location.distanceTo(lastReport) < locationRequest.getSmallestDesplacement()) { - return true; - } - } - lastReport = new Location(location); - lastReport.setProvider("fused"); - Log.d(TAG, "sending Location: " + location + " to " + packageName); - if (listener != null) { - try { - listener.onLocationChanged(lastReport); - } catch (RemoteException e) { - return false; - } - } else if (pendingIntent != null) { - Intent intent = new Intent(); - intent.putExtra("com.google.android.location.LOCATION", lastReport); - try { - pendingIntent.send(context, 0, intent); - } catch (PendingIntent.CanceledException e) { - return false; - } - } else if (callback != null) { - try { - callback.onLocationResult(LocationResult.create(Arrays.asList(lastReport))); - } catch (RemoteException e) { - return false; - } - } - numReports++; - return numReports < locationRequest.getNumUpdates(); - } - - @Override - public String toString() { - return "LocationRequestHelper{" + - "locationRequest=" + locationRequest + - ", hasFinePermission=" + hasFinePermission() + - ", hasCoarsePermission=" + hasCoarsePermission() + - ", packageName='" + packageName + '\'' + - ", lastReport=" + lastReport + - '}'; - } - - public boolean respondsTo(ILocationListener listener) { - return this.listener != null && listener != null && - this.listener.asBinder().equals(listener.asBinder()); - } - - public boolean respondsTo(ILocationCallback callback) { - return this.callback != null && callback != null && - this.callback.asBinder().equals(callback.asBinder()); - } - - public boolean respondsTo(PendingIntent pendingIntent) { - return this.pendingIntent != null && this.pendingIntent.equals(pendingIntent); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - LocationRequestHelper that = (LocationRequestHelper) o; - - if (!locationRequest.equals(that.locationRequest)) return false; - if (packageName != null ? !packageName.equals(that.packageName) : that.packageName != null) return false; - if (listener != null ? !listener.equals(that.listener) : that.listener != null) return false; - if (pendingIntent != null ? !pendingIntent.equals(that.pendingIntent) : that.pendingIntent != null) - return false; - return !(callback != null ? !callback.equals(that.callback) : that.callback != null); - } - - public boolean hasFinePermission() { - if (Build.VERSION.SDK_INT >= 19) { - return isAppOpsAllowed(AppOpsManager.OPSTR_FINE_LOCATION, initialHasFinePermission); - } else { - return initialHasFinePermission; - } - } - - public boolean hasCoarsePermission() { - if (Build.VERSION.SDK_INT >= 19) { - return isAppOpsAllowed(AppOpsManager.OPSTR_COARSE_LOCATION, initialHasCoarsePermission); - } else { - return initialHasCoarsePermission; - } - } - - @TargetApi(19) - private boolean isAppOpsAllowed(String op, boolean def) { - AppOpsManager appOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE); - if (appOpsManager == null) return def; - try { - if (Binder.getCallingUid() == uid && Build.VERSION.SDK_INT >= 23) { - return appOpsManager.noteProxyOpNoThrow(op, packageName) == AppOpsManager.MODE_ALLOWED; - } else if (Build.VERSION.SDK_INT >= 29) { - return appOpsManager.noteProxyOpNoThrow(op, packageName, uid) == AppOpsManager.MODE_ALLOWED; - } else if (selfHasAppOpsRights) { - return appOpsManager.noteOpNoThrow(op, uid, packageName) == AppOpsManager.MODE_ALLOWED; - } else { - // TODO: More variant that works pre-29 and without perms? - Log.w(TAG, "Can't check appops (yet)"); - return def; - } - } catch (Exception e) { - Log.w(TAG, e); - return def; - } - } - - @Override - public int hashCode() { - int result = locationRequest.hashCode(); - result = 31 * result + (packageName != null ? packageName.hashCode() : 0); - result = 31 * result + (listener != null ? listener.hashCode() : 0); - result = 31 * result + (pendingIntent != null ? pendingIntent.hashCode() : 0); - result = 31 * result + (callback != null ? callback.hashCode() : 0); - return result; - } -} diff --git a/play-services-location-core/src/main/java/org/microg/gms/location/MockLocationProvider.java b/play-services-location-core/src/main/java/org/microg/gms/location/MockLocationProvider.java deleted file mode 100644 index bdeb7318..00000000 --- a/play-services-location-core/src/main/java/org/microg/gms/location/MockLocationProvider.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.location.Location; -import android.os.Bundle; - -import static org.microg.gms.location.LocationConstants.KEY_MOCK_LOCATION; - -public class MockLocationProvider { - private boolean mockEnabled = false; - private Location mockLocation = null; - private final LocationChangeListener changeListener; - - public MockLocationProvider(LocationChangeListener changeListener) { - this.changeListener = changeListener; - } - - public void setMockEnabled(boolean mockEnabled) { - this.mockEnabled = mockEnabled; - } - - public Location getLocation() { - return mockEnabled ? mockLocation : null; - } - - public void setLocation(Location mockLocation) { - if (mockLocation.getExtras() == null) { - mockLocation.setExtras(new Bundle()); - } - mockLocation.getExtras().putBoolean(KEY_MOCK_LOCATION, false); - this.mockLocation = mockLocation; - this.changeListener.onLocationChanged(); - } -} diff --git a/play-services-location-core/src/main/java/org/microg/gms/location/RealLocationProvider.java b/play-services-location-core/src/main/java/org/microg/gms/location/RealLocationProvider.java deleted file mode 100644 index 0ae75148..00000000 --- a/play-services-location-core/src/main/java/org/microg/gms/location/RealLocationProvider.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.location.Location; -import android.location.LocationListener; -import android.location.LocationManager; -import android.os.Bundle; -import android.os.Looper; -import android.util.Log; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.atomic.AtomicBoolean; - -@SuppressWarnings("MissingPermission") -public class RealLocationProvider { - public static final String TAG = "GmsLocProviderReal"; - - private final LocationManager locationManager; - private final String name; - private final AtomicBoolean connected = new AtomicBoolean(false); - private final LocationChangeListener changeListener; - - private long connectedMinTime; - private float connectedMinDistance; - private Location lastLocation; - private final List requests = new ArrayList(); - private LocationListener listener = new LocationListener() { - @Override - public void onLocationChanged(Location location) { - lastLocation = location; - changeListener.onLocationChanged(); - } - - @Override - public void onStatusChanged(String s, int i, Bundle bundle) { - - } - - @Override - public void onProviderEnabled(String s) { - - } - - @Override - public void onProviderDisabled(String s) { - - } - }; - - public RealLocationProvider(LocationManager locationManager, String name, LocationChangeListener changeListener) { - this.locationManager = locationManager; - this.name = name; - this.changeListener = changeListener; - updateLastLocation(); - } - - private void updateLastLocation() { - Location newLocation = locationManager.getLastKnownLocation(name); - if (newLocation != null) lastLocation = newLocation; - } - - public Location getLastLocation() { - if (!connected.get()) { - updateLastLocation(); - } - if (lastLocation == null) { - Log.d(TAG, "uh-ok: last location for " + name + " is null!"); - } - return lastLocation; - } - - public void addRequest(LocationRequestHelper request) { - Log.d(TAG, name + ": addRequest " + request); - for (int i = 0; i < requests.size(); i++) { - LocationRequestHelper req = requests.get(i); - if (req.respondsTo(request.pendingIntent) || req.respondsTo(request.listener) || req.respondsTo(request.callback)) { - requests.remove(i); - i--; - } - } - requests.add(request); - updateConnection(); - } - - public void removeRequest(LocationRequestHelper request) { - Log.d(TAG, name + ": removeRequest " + request); - requests.remove(request); - updateConnection(); - } - - private synchronized void updateConnection() { - if (connected.get() && requests.isEmpty()) { - Log.d(TAG, name + ": no longer requesting location update"); - locationManager.removeUpdates(listener); - connected.set(false); - } else if (!requests.isEmpty()) { - long minTime = Long.MAX_VALUE; - float minDistance = Float.MAX_VALUE; - StringBuilder sb = new StringBuilder(); - for (LocationRequestHelper request : requests) { - minTime = Math.min(request.locationRequest.getInterval(), minTime); - minDistance = Math.min(request.locationRequest.getSmallestDesplacement(), minDistance); - if (sb.length() != 0) sb.append(", "); - sb.append(request.packageName).append(":").append(request.locationRequest.getInterval()).append("ms"); - } - Log.d(TAG, name + ": requesting location updates with interval " + minTime + "ms (" + sb + "), minDistance=" + minDistance); - if (connected.get()) { - if (connectedMinTime != minTime || connectedMinDistance != minDistance) { - locationManager.removeUpdates(listener); - locationManager.requestLocationUpdates(name, minTime, minDistance, listener, - Looper.getMainLooper()); - } - } else { - locationManager.requestLocationUpdates(name, minTime, minDistance, listener, Looper.getMainLooper()); - } - connected.set(true); - connectedMinTime = minTime; - connectedMinDistance = minDistance; - } - } -} diff --git a/play-services-location-core/src/main/java/org/microg/gms/location/ReportingAndroidService.java b/play-services-location-core/src/main/java/org/microg/gms/location/ReportingAndroidService.java deleted file mode 100644 index d382cdcc..00000000 --- a/play-services-location-core/src/main/java/org/microg/gms/location/ReportingAndroidService.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.os.RemoteException; - -import com.google.android.gms.common.internal.GetServiceRequest; -import com.google.android.gms.common.internal.IGmsCallbacks; - -import org.microg.gms.BaseService; -import org.microg.gms.common.GmsService; - -public class ReportingAndroidService extends BaseService { - private ReportingServiceImpl reportingService = new ReportingServiceImpl(); - - public ReportingAndroidService() { - super("GmsLocReportingSvc", GmsService.LOCATION_REPORTING); - } - - @Override - public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException { - callback.onPostInitComplete(0, reportingService.asBinder(), null); - } -} diff --git a/play-services-location-core/src/main/java/org/microg/gms/location/ReportingServiceImpl.java b/play-services-location-core/src/main/java/org/microg/gms/location/ReportingServiceImpl.java deleted file mode 100644 index c091cbde..00000000 --- a/play-services-location-core/src/main/java/org/microg/gms/location/ReportingServiceImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.accounts.Account; -import android.os.RemoteException; -import android.util.Log; - -import com.google.android.gms.location.places.PlaceReport; -import com.google.android.gms.location.reporting.ReportingState; -import com.google.android.gms.location.reporting.UploadRequest; -import com.google.android.gms.location.reporting.UploadRequestResult; -import com.google.android.gms.location.reporting.internal.IReportingService; - -public class ReportingServiceImpl extends IReportingService.Stub { - private static final String TAG = "GmsLocReportSvcImpl"; - - @Override - public ReportingState getReportingState(Account account) throws RemoteException { - Log.d(TAG, "getReportingState"); - return new ReportingState(); - } - - @Override - public int tryOptIn(Account account) throws RemoteException { - Log.d(TAG, "tryOptIn"); - return 0; - } - - @Override - public UploadRequestResult requestUpload(UploadRequest request) throws RemoteException { - Log.d(TAG, "requestUpload"); - return new UploadRequestResult(); - } - - @Override - public int cancelUploadRequest(long l) throws RemoteException { - Log.d(TAG, "cancelUploadRequest"); - return 0; - } - - @Override - public int reportDeviceAtPlace(Account account, PlaceReport report) throws RemoteException { - Log.d(TAG, "reportDeviceAtPlace"); - return 0; - } -} diff --git a/play-services-location-core/src/main/java/org/microg/gms/location/UnifiedLocationProvider.kt b/play-services-location-core/src/main/java/org/microg/gms/location/UnifiedLocationProvider.kt deleted file mode 100644 index 51cbfbf5..00000000 --- a/play-services-location-core/src/main/java/org/microg/gms/location/UnifiedLocationProvider.kt +++ /dev/null @@ -1,95 +0,0 @@ -package org.microg.gms.location - -import android.content.Context -import android.location.Location -import android.util.Log -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.launch -import org.microg.nlp.client.UnifiedLocationClient -import java.util.* -import java.util.concurrent.atomic.AtomicBoolean - -class UnifiedLocationProvider(context: Context?, changeListener: LocationChangeListener) { - private val client: UnifiedLocationClient - private var connectedMinTime: Long = 0 - private var lastLocation: Location? = null - private val connected = AtomicBoolean(false) - private val changeListener: LocationChangeListener - private val requests: MutableList = ArrayList() - private val listener: UnifiedLocationClient.LocationListener = object : UnifiedLocationClient.LocationListener { - override fun onLocation(location: Location) { - lastLocation = location - changeListener.onLocationChanged() - } - } - - private fun updateLastLocation() { - GlobalScope.launch { - client.getLastLocation()?.let { lastLocation = it } - } - } - - fun addRequest(request: LocationRequestHelper) { - Log.d(TAG, "unified network: addRequest $request") - for (i in 0..requests.size) { - if (i >= requests.size) break - val req = requests[i] - if (req.respondsTo(request.pendingIntent) || req.respondsTo(request.listener) || req.respondsTo(request.callback)) { - requests.removeAt(i) - } - } - requests.add(request) - updateConnection() - } - - fun removeRequest(request: LocationRequestHelper) { - Log.d(TAG, "unified network: removeRequest $request") - requests.remove(request) - updateConnection() - } - - fun getLastLocation(): Location? { - if (lastLocation == null) { - Log.d(TAG, "uh-ok: last location for unified network is null!") - } - return lastLocation - } - - @Synchronized - private fun updateConnection() { - if (connected.get() && requests.isEmpty()) { - Log.d(TAG, "unified network: no longer requesting location update") - client.removeLocationUpdates(listener) - connected.set(false) - } else if (!requests.isEmpty()) { - var minTime = Long.MAX_VALUE - val sb = StringBuilder() - var opPackageName: String? = null - for (request in requests) { - if (request.locationRequest.interval < minTime) { - opPackageName = request.packageName - minTime = request.locationRequest.interval - } - if (sb.isNotEmpty()) sb.append(", ") - sb.append("${request.packageName}:${request.locationRequest.interval}ms") - } - client.opPackageName = opPackageName - Log.d(TAG, "unified network: requesting location updates with interval ${minTime}ms ($sb)") - if (!connected.get() || connectedMinTime != minTime) { - client.requestLocationUpdates(listener, minTime) - } - connected.set(true) - connectedMinTime = minTime - } - } - - companion object { - const val TAG = "GmsLocProviderU" - } - - init { - client = UnifiedLocationClient[context!!] - this.changeListener = changeListener - updateLastLocation() - } -} \ No newline at end of file diff --git a/play-services-location/build.gradle b/play-services-location/build.gradle deleted file mode 100644 index a19126df..00000000 --- a/play-services-location/build.gradle +++ /dev/null @@ -1,47 +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. - */ - -apply plugin: 'com.android.library' - -String getMyVersionName() { - def stdout = new ByteArrayOutputStream() - 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) -} - -android { - compileSdkVersion androidCompileSdk() - buildToolsVersion "$androidBuildVersionTools" - - defaultConfig { - versionName getMyVersionName() - minSdkVersion androidMinSdk() - targetSdkVersion androidTargetSdk() - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } -} - -dependencies { - api project(':play-services-base') - api project(':play-services-location-api') -} \ No newline at end of file diff --git a/play-services-location/gradle.properties b/play-services-location/gradle.properties deleted file mode 100644 index bfc9b4b2..00000000 --- a/play-services-location/gradle.properties +++ /dev/null @@ -1,34 +0,0 @@ -# -# 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. -# - -POM_NAME=Play Services Cast Library -POM_DESCRIPTION=The Play Services Library module to access Google Location Services - -POM_PACKAGING=aar - -POM_URL=https://github.com/microg/android_external_GmsLib - -POM_SCM_URL=https://github.com/microg/android_external_GmsLib -POM_SCM_CONNECTION=scm:git@github.com:microg/android_external_GmsLib.git -POM_SCM_DEV_CONNECTION=scm:git@github.com:microg/android_external_GmsLib.git - -POM_LICENCE_NAME=The Apache Software License, Version 2.0 -POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt -POM_LICENCE_DIST=repo - -POM_DEVELOPER_ID=mar-v-in -POM_DEVELOPER_NAME=Marvin W - diff --git a/play-services-location/src/main/AndroidManifest.xml b/play-services-location/src/main/AndroidManifest.xml deleted file mode 100644 index 79e10fc2..00000000 --- a/play-services-location/src/main/AndroidManifest.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - diff --git a/play-services-location/src/main/java/com/google/android/gms/location/ActivityRecognition.java b/play-services-location/src/main/java/com/google/android/gms/location/ActivityRecognition.java deleted file mode 100644 index ef9d76c3..00000000 --- a/play-services-location/src/main/java/com/google/android/gms/location/ActivityRecognition.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2017 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.location; - -import com.google.android.gms.common.api.Api; -import com.google.android.gms.common.api.GoogleApiClient.Builder; - -import org.microg.gms.location.ActivityRecognitionApiBuilder; -import org.microg.gms.location.ActivityRecognitionApiImpl; - -/** - * The main entry point for activity recognition integration. - */ -public class ActivityRecognition { - public static final String CLIENT_NAME = "activity_recognition"; - - /** - * Token to pass to {@link Builder#addApi(Api)} to enable ContextServices. - */ - public static final Api API = new Api(new ActivityRecognitionApiBuilder()); - - /** - * Entry point to the activity recognition APIs. - */ - public static final ActivityRecognitionApi ActivityRecognitionApi = new ActivityRecognitionApiImpl(); -} diff --git a/play-services-location/src/main/java/com/google/android/gms/location/ActivityRecognitionApi.java b/play-services-location/src/main/java/com/google/android/gms/location/ActivityRecognitionApi.java deleted file mode 100644 index 08bc50b9..00000000 --- a/play-services-location/src/main/java/com/google/android/gms/location/ActivityRecognitionApi.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (C) 2017 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.location; - -import android.app.PendingIntent; -import android.os.Bundle; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks; -import com.google.android.gms.common.api.PendingResult; -import com.google.android.gms.common.api.Status; - -/** - * The main entry point for interacting with activity recognition. - *

- * The methods must be used in conjunction with a GoogleApiClient. E.g. - *

- *  new GoogleApiClient.Builder(context)
- *          .addApi(ActivityRecognition.API)
- *          .addConnectionCallbacks(this)
- *          .addOnConnectionFailedListener(this)
- *          .build()
- * 
- */ -public interface ActivityRecognitionApi { - /** - * Removes all activity updates for the specified PendingIntent. - *

- * Calling this function requires the com.google.android.gms.permission.ACTIVITY_RECOGNITION - * permission. - * - * @param client An existing GoogleApiClient. It must be connected at the time of this - * call, which is normally achieved by calling {@link GoogleApiClient#connect()} - * and waiting for {@link ConnectionCallbacks#onConnected(Bundle)} to be - * called. - * @param callbackIntent the PendingIntent that was used in {@code #requestActivityUpdates(GoogleApiClient, long, PendingIntent)} - * or is equal as defined by {@link Object#equals(Object)}. - * @return a PendingResult for the call, check {@link Status#isSuccess()} to determine if it - * was successful. - */ - PendingResult removeActivityUpdates(GoogleApiClient client, PendingIntent callbackIntent); - - /** - * Register for activity recognition updates. - *

- * The activities are detected by periodically waking up the device and reading short bursts of - * sensor data. It only makes use of low power sensors in order to keep the power usage to a - * minimum. For example, it can detect if the user is currently on foot, in a car, on a bicycle - * or still. See {@link DetectedActivity} for more details. - *

- * The activity detection update interval can be controlled with the detectionIntervalMillis - * parameter. Larger values will result in fewer activity detections while improving battery - * life. Smaller values will result in more frequent activity detections but will consume more - * power since the device must be woken up more frequently. {@code Long.MAX_VALUE} means it only - * monitors the results requested by other clients without consuming additional power. - *

- * Activities may be received more frequently than the detectionIntervalMillis parameter if - * another application has also requested activity updates at a faster rate. It may also receive - * updates faster when the activity detection service receives a signal that the current - * activity may change, such as if the device has been still for a long period of time and is - * then unplugged from a phone charger. - *

- * Activities may arrive several seconds after the requested detectionIntervalMillis if the - * activity detection service requires more samples to make a more accurate prediction. - *

- * To conserve battery, activity reporting may stop when the device is 'STILL' for an extended - * period of time. It will resume once the device moves again. This only happens on devices that - * support the Sensor.TYPE_SIGNIFICANT_MOTION hardware. - *

- * Beginning in API 21, activities may be received less frequently than the - * detectionIntervalMillis parameter if the device is in power save mode and the screen is off. - *

- * A common use case is that an application wants to monitor activities in the background and - * perform an action when a specific activity is detected. To do this without needing a service - * that is always on in the background consuming resources, detected activities are delivered - * via an intent. The application specifies a PendingIntent callback (typically an - * IntentService) which will be called with an intent when activities are detected. The intent - * recipient can extract the {@link ActivityRecognitionResult} using {@link ActivityRecognitionResult#extractResult(android.content.Intent)}. - * See the documentation of {@link PendingIntent} for more details. - *

- * Any requests previously registered with {@link #requestActivityUpdates(GoogleApiClient, long, PendingIntent)} - * that have the same PendingIntent (as defined by {@link Object#equals(Object)}) will be - * replaced by this request. - *

- * Calling this function requires the com.google.android.gms.permission.ACTIVITY_RECOGNITION - * permission. - * - * @param client An existing GoogleApiClient. It must be connected at the time - * of this call, which is normally achieved by calling {@link GoogleApiClient#connect()} - * and waiting for {@link ConnectionCallbacks#onConnected(Bundle)} - * to be called. - * @param detectionIntervalMillis the desired time between activity detections. Larger values - * will result in fewer activity detections while improving - * battery life. A value of 0 will result in activity detections - * at the fastest possible rate. - * @param callbackIntent a PendingIntent to be sent for each activity detection. - * @return a PendingResult for the call, check {@link Status#isSuccess()} to determine if it - * was successful. - */ - PendingResult requestActivityUpdates(GoogleApiClient client, long detectionIntervalMillis, PendingIntent callbackIntent); -} diff --git a/play-services-location/src/main/java/com/google/android/gms/location/FusedLocationProviderApi.java b/play-services-location/src/main/java/com/google/android/gms/location/FusedLocationProviderApi.java deleted file mode 100644 index 768111b5..00000000 --- a/play-services-location/src/main/java/com/google/android/gms/location/FusedLocationProviderApi.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.app.PendingIntent; -import android.location.Location; -import android.os.Looper; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.PendingResult; -import com.google.android.gms.common.api.Status; - -import org.microg.gms.location.LocationConstants; - -public interface FusedLocationProviderApi { - @Deprecated - String KEY_LOCATION_CHANGED = "com.google.android.location.LOCATION"; - String KEY_MOCK_LOCATION = LocationConstants.KEY_MOCK_LOCATION; - - Location getLastLocation(GoogleApiClient client); - - PendingResult requestLocationUpdates(GoogleApiClient client, LocationRequest request, - LocationListener listener); - - PendingResult requestLocationUpdates(GoogleApiClient client, LocationRequest request, - LocationListener listener, Looper looper); - - PendingResult requestLocationUpdates(GoogleApiClient client, LocationRequest request, - PendingIntent callbackIntent); - - PendingResult removeLocationUpdates(GoogleApiClient client, LocationListener listener); - - PendingResult removeLocationUpdates(GoogleApiClient client, - PendingIntent callbackIntent); - - PendingResult setMockMode(GoogleApiClient client, boolean isMockMode); - - PendingResult setMockLocation(GoogleApiClient client, Location mockLocation); -} diff --git a/play-services-location/src/main/java/com/google/android/gms/location/GeofencingApi.java b/play-services-location/src/main/java/com/google/android/gms/location/GeofencingApi.java deleted file mode 100644 index 784c5c3e..00000000 --- a/play-services-location/src/main/java/com/google/android/gms/location/GeofencingApi.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.app.PendingIntent; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.PendingResult; -import com.google.android.gms.common.api.Status; - -import java.util.List; - -/** - * The main entry point for interacting with the geofencing APIs. - *

- * The methods must be used in conjunction with a GoogleApiClient. E.g. - *

- *  new GoogleApiClient.Builder(context)
- *          .addApi(LocationServices.API)
- *          .addConnectionCallbacks(this)
- *          .addOnConnectionFailedListener(this)
- *          .build()
- * 
- */ -public interface GeofencingApi { - PendingResult addGeofences(GoogleApiClient client, GeofencingRequest geofencingRequest, PendingIntent pendingIntent); - - @Deprecated - PendingResult addGeofences(GoogleApiClient client, List geofences, PendingIntent pendingIntent); - - PendingResult removeGeofences(GoogleApiClient client, List geofenceRequestIds); - - PendingResult removeGeofences(GoogleApiClient client, PendingIntent pendingIntent); -} diff --git a/play-services-location/src/main/java/com/google/android/gms/location/LocationClient.java b/play-services-location/src/main/java/com/google/android/gms/location/LocationClient.java deleted file mode 100644 index 47ec9568..00000000 --- a/play-services-location/src/main/java/com/google/android/gms/location/LocationClient.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.app.PendingIntent; -import android.content.Context; -import android.location.Location; -import android.os.Looper; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.PendingResult; - -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"; - - public LocationClient(Context context, ConnectionCallbacks callbacks, - OnConnectionFailedListener connectionFailedListener) { - super(new GoogleApiClient.Builder(context) - .addApi(LocationServices.API) - .addConnectionCallbacks(new ForwardConnectionCallbacks(callbacks)) - .addOnConnectionFailedListener(new ForwardConnectionFailedListener - (connectionFailedListener)) - .build()); - } - - public Location getLastLocation() { - assertConnected(); - return LocationServices.FusedLocationApi.getLastLocation(googleApiClient); - } - - public void requestLocationUpdates(LocationRequest request, - LocationListener listener) { - assertConnected(); - LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, request, - listener).await(); - } - - public void requestLocationUpdates(LocationRequest request, - LocationListener listener, Looper looper) { - assertConnected(); - LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, request, - listener, looper).await(); - } - - public void requestLocationUpdates(LocationRequest request, - PendingIntent callbackIntent) { - assertConnected(); - LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, request, - callbackIntent).await(); - } - - public void removeLocationUpdates(LocationListener listener) { - assertConnected(); - LocationServices.FusedLocationApi.removeLocationUpdates(googleApiClient, listener).await(); - } - - public void removeLocationUpdates(PendingIntent callbackIntent) { - assertConnected(); - LocationServices.FusedLocationApi.removeLocationUpdates(googleApiClient, - callbackIntent).await(); - } - - public void setMockMode(boolean isMockMode) { - assertConnected(); - LocationServices.FusedLocationApi.setMockMode(googleApiClient, isMockMode).await(); - } - - public void setMockLocation(Location mockLocation) { - assertConnected(); - LocationServices.FusedLocationApi.setMockLocation(googleApiClient, mockLocation).await(); - } -} diff --git a/play-services-location/src/main/java/com/google/android/gms/location/LocationListener.java b/play-services-location/src/main/java/com/google/android/gms/location/LocationListener.java deleted file mode 100644 index 59c9585c..00000000 --- a/play-services-location/src/main/java/com/google/android/gms/location/LocationListener.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.location.Location; - -/** - * Used for receiving notifications from the {@link FusedLocationProviderApi} when the location has - * changed. The methods are called if the LocationListener has been registered with the location - * client. - */ -public interface LocationListener { - - /** - * Called when the location has changed. - * - * @param location The updated location. - */ - public void onLocationChanged(Location location); -} diff --git a/play-services-location/src/main/java/com/google/android/gms/location/LocationServices.java b/play-services-location/src/main/java/com/google/android/gms/location/LocationServices.java deleted file mode 100644 index 839550f4..00000000 --- a/play-services-location/src/main/java/com/google/android/gms/location/LocationServices.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import com.google.android.gms.common.api.Api; -import com.google.android.gms.common.api.GoogleApiClient.Builder; - -import org.microg.gms.location.FusedLocationProviderApiImpl; -import org.microg.gms.location.GeofencingApiImpl; -import org.microg.gms.location.LocationServicesApiBuilder; -import org.microg.gms.location.SettingsApiImpl; - -/** - * The main entry point for location services integration. - */ -public class LocationServices { - /** - * Token to pass to {@link Builder#addApi(Api)} to enable LocationServices. - */ - public static final Api API = new Api(new LocationServicesApiBuilder()); - - /** - * Entry point to the fused location APIs. - */ - public static final FusedLocationProviderApi FusedLocationApi = new FusedLocationProviderApiImpl(); - - /** - * Entry point to the geofencing APIs. - */ - public static final GeofencingApi GeofencingApi = new GeofencingApiImpl(); - - /** - * Entry point to the location settings-enabler dialog APIs. - */ - public static final SettingsApi SettingsApi = new SettingsApiImpl(); -} diff --git a/play-services-location/src/main/java/com/google/android/gms/location/LocationStatusCodes.java b/play-services-location/src/main/java/com/google/android/gms/location/LocationStatusCodes.java deleted file mode 100644 index 4e3f7d54..00000000 --- a/play-services-location/src/main/java/com/google/android/gms/location/LocationStatusCodes.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2017 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.location; - -@Deprecated -public class LocationStatusCodes { - public static final int ERROR = 1; - public static final int GEOFENCE_NOT_AVAILABLE = 1000; - public static final int GEOFENCE_TOO_MANY_GEOFENCES = 1001; - public static final int GEOFENCE_TOO_MANY_PENDING_INTENTS = 1002; - public static final int SUCCESS = 0; -} diff --git a/play-services-location/src/main/java/com/google/android/gms/location/SettingsApi.java b/play-services-location/src/main/java/com/google/android/gms/location/SettingsApi.java deleted file mode 100644 index 708d7d02..00000000 --- a/play-services-location/src/main/java/com/google/android/gms/location/SettingsApi.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2017 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.location; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.PendingResult; - -/** - * The main entry point for interacting with the location settings-enabler APIs. - *

- * This API makes it easy for an app to ensure that the device's system settings are properly - * configured for the app's location needs. - */ -public interface SettingsApi { - /** - * Checks if the relevant system settings are enabled on the device to carry out the desired - * location requests. - * - * @param client an existing GoogleApiClient. It does not need to be connected - * at the time of this call, but the result will be delayed until - * the connection is complete. - * @param locationSettingsRequest an object that contains all the location requirements that the - * client is interested in. - * @return result containing the status of the request. - */ - PendingResult checkLocationSettings(GoogleApiClient client, LocationSettingsRequest locationSettingsRequest); -} diff --git a/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionApiBuilder.java b/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionApiBuilder.java deleted file mode 100644 index f36ed0c0..00000000 --- a/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionApiBuilder.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2017 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.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 ActivityRecognitionApiBuilder implements ApiBuilder { - @Override - public ApiConnection build(Context context, Looper looper, Api.ApiOptions.NoOptions options, AccountInfo accountInfo, GoogleApiClient.ConnectionCallbacks callbacks, GoogleApiClient.OnConnectionFailedListener connectionFailedListener) { - return new ActivityRecognitionClientImpl(context, callbacks, connectionFailedListener); - } -} diff --git a/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionApiImpl.java b/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionApiImpl.java deleted file mode 100644 index 5c09eefd..00000000 --- a/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionApiImpl.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2017 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.location; - -import android.app.PendingIntent; -import android.os.RemoteException; -import android.util.Log; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.PendingResult; -import com.google.android.gms.common.api.Status; -import com.google.android.gms.location.ActivityRecognition; -import com.google.android.gms.location.ActivityRecognitionApi; - -import org.microg.gms.common.GmsConnector; - -public class ActivityRecognitionApiImpl implements ActivityRecognitionApi { - private static final String TAG = "GmsActivityApiImpl"; - - @Override - public PendingResult removeActivityUpdates(GoogleApiClient client, final PendingIntent callbackIntent) { - return callVoid(client, new Runnable() { - @Override - public void run(ActivityRecognitionClientImpl client) throws RemoteException { - client.removeActivityUpdates(callbackIntent); - } - }); - } - - @Override - public PendingResult requestActivityUpdates(GoogleApiClient client, final long detectionIntervalMillis, final PendingIntent callbackIntent) { - return callVoid(client, new Runnable() { - @Override - public void run(ActivityRecognitionClientImpl client) throws RemoteException { - client.requestActivityUpdates(detectionIntervalMillis, callbackIntent); - } - }); - } - - private PendingResult callVoid(GoogleApiClient client, final Runnable runnable) { - return GmsConnector.call(client, ActivityRecognition.API, new GmsConnector.Callback() { - @Override - public void onClientAvailable(ActivityRecognitionClientImpl client, ResultProvider resultProvider) throws RemoteException { - runnable.run(client); - resultProvider.onResultAvailable(Status.SUCCESS); - } - }); - } - - private interface Runnable { - void run(ActivityRecognitionClientImpl client) throws RemoteException; - } -} diff --git a/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionClientImpl.java b/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionClientImpl.java deleted file mode 100644 index cf065fc9..00000000 --- a/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionClientImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2017 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.location; - -import android.app.PendingIntent; -import android.content.Context; -import android.os.RemoteException; - -import com.google.android.gms.common.api.GoogleApiClient; - -public class ActivityRecognitionClientImpl extends GoogleLocationManagerClient { - public ActivityRecognitionClientImpl(Context context, GoogleApiClient.ConnectionCallbacks callbacks, GoogleApiClient.OnConnectionFailedListener connectionFailedListener) { - super(context, callbacks, connectionFailedListener); - } - - public void requestActivityUpdates(long detectionIntervalMillis, PendingIntent callbackIntent) throws RemoteException { - getServiceInterface().requestActivityUpdates(detectionIntervalMillis, true, callbackIntent); - } - - public void removeActivityUpdates(PendingIntent callbackIntent) throws RemoteException { - getServiceInterface().removeActivityUpdates(callbackIntent); - } -} diff --git a/play-services-location/src/main/java/org/microg/gms/location/FusedLocationProviderApiImpl.java b/play-services-location/src/main/java/org/microg/gms/location/FusedLocationProviderApiImpl.java deleted file mode 100644 index 0069974c..00000000 --- a/play-services-location/src/main/java/org/microg/gms/location/FusedLocationProviderApiImpl.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.app.PendingIntent; -import android.location.Location; -import android.os.Looper; -import android.os.RemoteException; -import android.util.Log; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.PendingResult; -import com.google.android.gms.common.api.Result; -import com.google.android.gms.common.api.Status; -import com.google.android.gms.location.FusedLocationProviderApi; -import com.google.android.gms.location.LocationListener; -import com.google.android.gms.location.LocationRequest; -import com.google.android.gms.location.LocationServices; - -import org.microg.gms.common.GmsConnector; -import org.microg.gms.common.api.ApiConnection; - -public class FusedLocationProviderApiImpl implements FusedLocationProviderApi { - private static final String TAG = "GmsFusedApiImpl"; - - @Override - public Location getLastLocation(GoogleApiClient client) { - try { - Log.d(TAG, "getLastLocation(" + client + ")"); - return LocationClientImpl.get(client).getLastLocation(); - } catch (RemoteException e) { - Log.w(TAG, e); - return null; - } - } - - @Override - public PendingResult requestLocationUpdates(GoogleApiClient client, - final LocationRequest request, final LocationListener listener) { - return callVoid(client, new Runnable() { - @Override - public void run(LocationClientImpl client) throws RemoteException { - client.requestLocationUpdates(request, listener); - } - }); - } - - @Override - public PendingResult requestLocationUpdates(GoogleApiClient client, - final LocationRequest request, final LocationListener listener, - final Looper looper) { - return callVoid(client, new Runnable() { - @Override - public void run(LocationClientImpl client) throws RemoteException { - client.requestLocationUpdates(request, listener, looper); - } - }); - } - - @Override - public PendingResult requestLocationUpdates(GoogleApiClient client, - final LocationRequest request, final PendingIntent callbackIntent) { - return callVoid(client, new Runnable() { - @Override - public void run(LocationClientImpl client) throws RemoteException { - client.requestLocationUpdates(request, callbackIntent); - } - }); - } - - @Override - public PendingResult removeLocationUpdates(GoogleApiClient client, - final LocationListener listener) { - return callVoid(client, new Runnable() { - @Override - public void run(LocationClientImpl client) throws RemoteException { - client.removeLocationUpdates(listener); - } - }); - } - - @Override - public PendingResult removeLocationUpdates(GoogleApiClient client, - final PendingIntent callbackIntent) { - return callVoid(client, new Runnable() { - @Override - public void run(LocationClientImpl client) throws RemoteException { - client.removeLocationUpdates(callbackIntent); - } - }); - } - - @Override - public PendingResult setMockMode(GoogleApiClient client, final boolean isMockMode) { - return callVoid(client, new Runnable() { - @Override - public void run(LocationClientImpl client) throws RemoteException { - client.setMockMode(isMockMode); - } - }); - } - - @Override - public PendingResult setMockLocation(GoogleApiClient client, final Location mockLocation) { - return callVoid(client, new Runnable() { - @Override - public void run(LocationClientImpl client) throws RemoteException { - client.setMockLocation(mockLocation); - } - }); - } - - private PendingResult callVoid(GoogleApiClient client, final Runnable runnable) { - return GmsConnector.call(client, LocationServices.API, new GmsConnector.Callback() { - @Override - public void onClientAvailable(LocationClientImpl client, ResultProvider resultProvider) throws RemoteException { - runnable.run(client); - resultProvider.onResultAvailable(Status.SUCCESS); - } - }); - } - - private interface Runnable { - void run(LocationClientImpl client) throws RemoteException; - } -} diff --git a/play-services-location/src/main/java/org/microg/gms/location/GeofencingApiImpl.java b/play-services-location/src/main/java/org/microg/gms/location/GeofencingApiImpl.java deleted file mode 100644 index aed9276d..00000000 --- a/play-services-location/src/main/java/org/microg/gms/location/GeofencingApiImpl.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.app.PendingIntent; -import android.os.RemoteException; -import android.support.annotation.NonNull; -import android.util.Log; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.PendingResult; -import com.google.android.gms.common.api.Status; -import com.google.android.gms.location.Geofence; -import com.google.android.gms.location.GeofencingApi; -import com.google.android.gms.location.GeofencingRequest; -import com.google.android.gms.location.LocationServices; -import com.google.android.gms.location.internal.IGeofencerCallbacks; -import com.google.android.gms.location.internal.ParcelableGeofence; - -import org.microg.gms.common.GmsConnector; - -import java.util.ArrayList; -import java.util.List; - -public class GeofencingApiImpl implements GeofencingApi { - @Override - public PendingResult addGeofences(GoogleApiClient client, final GeofencingRequest geofencingRequest, final PendingIntent pendingIntent) { - return callGeofencer(client, new Runnable() { - @Override - public void run(LocationClientImpl client, IGeofencerCallbacks callbacks) throws RemoteException { - client.addGeofences(geofencingRequest, pendingIntent, callbacks); - } - }); - } - - @Override - public PendingResult addGeofences(GoogleApiClient client, final List geofences, final PendingIntent pendingIntent) { - final List geofenceList = new ArrayList(); - for (Geofence geofence : geofences) { - if (geofence instanceof ParcelableGeofence) geofenceList.add((ParcelableGeofence) geofence); - } - return callGeofencer(client, new Runnable() { - @Override - public void run(LocationClientImpl client, IGeofencerCallbacks callbacks) throws RemoteException { - client.addGeofences(geofenceList, pendingIntent, callbacks); - } - }); - } - - @Override - public PendingResult removeGeofences(GoogleApiClient client, final List geofenceRequestIds) { - return callGeofencer(client, new Runnable() { - @Override - public void run(LocationClientImpl client, IGeofencerCallbacks callbacks) throws RemoteException { - client.removeGeofences(geofenceRequestIds, callbacks); - } - }); - } - - @Override - public PendingResult removeGeofences(GoogleApiClient client, final PendingIntent pendingIntent) { - return callGeofencer(client, new Runnable() { - @Override - public void run(LocationClientImpl client, IGeofencerCallbacks callbacks) throws RemoteException { - client.removeGeofences(pendingIntent, callbacks); - } - }); - } - - @NonNull - private IGeofencerCallbacks.Stub createGeofencerCallbacks(final GmsConnector.Callback.ResultProvider resultProvider) { - return new IGeofencerCallbacks.Stub(){ - @Override - public void onAddGeofenceResult(int statusCode, String[] requestIds) throws RemoteException { - resultProvider.onResultAvailable(new Status(statusCode)); - } - - @Override - public void onRemoveGeofencesByRequestIdsResult(int statusCode, String[] requestIds) throws RemoteException { - resultProvider.onResultAvailable(new Status(statusCode)); - } - - @Override - public void onRemoveGeofencesByPendingIntentResult(int statusCode, PendingIntent pendingIntent) throws RemoteException { - resultProvider.onResultAvailable(new Status(statusCode)); - } - }; - } - - private PendingResult callGeofencer(GoogleApiClient client, final Runnable runnable) { - return GmsConnector.call(client, LocationServices.API, new GmsConnector.Callback() { - @Override - public void onClientAvailable(LocationClientImpl client, ResultProvider resultProvider) throws RemoteException { - runnable.run(client, createGeofencerCallbacks(resultProvider)); - } - }); - } - - private interface Runnable { - void run(LocationClientImpl client, IGeofencerCallbacks callbacks) throws RemoteException; - } -} diff --git a/play-services-location/src/main/java/org/microg/gms/location/GoogleLocationManagerClient.java b/play-services-location/src/main/java/org/microg/gms/location/GoogleLocationManagerClient.java deleted file mode 100644 index 55d0fae9..00000000 --- a/play-services-location/src/main/java/org/microg/gms/location/GoogleLocationManagerClient.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.content.Context; -import android.os.Bundle; -import android.os.IBinder; -import android.os.RemoteException; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.internal.IGmsServiceBroker; -import com.google.android.gms.location.internal.IGoogleLocationManagerService; - -import org.microg.gms.common.Constants; -import org.microg.gms.common.GmsClient; -import org.microg.gms.common.GmsService; - -public abstract class GoogleLocationManagerClient extends GmsClient { - public GoogleLocationManagerClient(Context context, GoogleApiClient.ConnectionCallbacks - callbacks, GoogleApiClient.OnConnectionFailedListener connectionFailedListener) { - super(context, callbacks, connectionFailedListener, GmsService.LOCATION_MANAGER.ACTION); - } - - @Override - protected IGoogleLocationManagerService interfaceFromBinder(IBinder binder) { - return IGoogleLocationManagerService.Stub.asInterface(binder); - } - - @Override - protected void onConnectedToBroker(IGmsServiceBroker broker, GmsCallbacks callbacks) - throws RemoteException { - Bundle bundle = new Bundle(); - bundle.putString("client_name", "locationServices"); - broker.getGoogleLocationManagerService(callbacks, Constants.MAX_REFERENCE_VERSION, - getContext().getPackageName(), bundle); - } -} diff --git a/play-services-location/src/main/java/org/microg/gms/location/LocationClientImpl.java b/play-services-location/src/main/java/org/microg/gms/location/LocationClientImpl.java deleted file mode 100644 index bc161d13..00000000 --- a/play-services-location/src/main/java/org/microg/gms/location/LocationClientImpl.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.app.PendingIntent; -import android.content.Context; -import android.location.Location; -import android.os.Bundle; -import android.os.Looper; -import android.os.RemoteException; -import android.util.Log; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.location.GeofencingRequest; -import com.google.android.gms.location.ILocationListener; -import com.google.android.gms.location.LocationListener; -import com.google.android.gms.location.LocationRequest; -import com.google.android.gms.location.LocationServices; -import com.google.android.gms.location.internal.IGeofencerCallbacks; -import com.google.android.gms.location.internal.ParcelableGeofence; - -import org.microg.gms.common.api.GoogleApiClientImpl; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class LocationClientImpl extends GoogleLocationManagerClient { - private static final String TAG = "GmsLocationClientImpl"; - private NativeLocationClientImpl nativeLocation = null; - private Map listenerMap = new HashMap(); - - - public LocationClientImpl(Context context, GoogleApiClient.ConnectionCallbacks callbacks, - GoogleApiClient.OnConnectionFailedListener connectionFailedListener) { - super(context, callbacks, connectionFailedListener); - Log.d(TAG, ""); - } - - public static LocationClientImpl get(GoogleApiClient apiClient) { - if (apiClient instanceof GoogleApiClientImpl) { - return (LocationClientImpl) ((GoogleApiClientImpl) apiClient) - .getApiConnection(LocationServices.API); - } - return null; - } - - public void addGeofences(GeofencingRequest request, PendingIntent pendingIntent, IGeofencerCallbacks callbacks) throws RemoteException { - if (nativeLocation != null) { - nativeLocation.addGeofences(request, pendingIntent, callbacks); - } else { - getServiceInterface().addGeofences(request, pendingIntent, callbacks); - } - } - - public void addGeofences(List request, PendingIntent pendingIntent, IGeofencerCallbacks callbacks) throws RemoteException { - if (nativeLocation != null) { - nativeLocation.addGeofences(request, pendingIntent, callbacks); - } else { - getServiceInterface().addGeofencesList(request, pendingIntent, callbacks, getContext().getPackageName()); - } - } - - public void removeGeofences(List geofenceRequestIds, IGeofencerCallbacks callbacks) throws RemoteException { - if (nativeLocation != null) { - nativeLocation.removeGeofences(geofenceRequestIds, callbacks); - } else { - getServiceInterface().removeGeofencesById(geofenceRequestIds.toArray(new String[geofenceRequestIds.size()]), callbacks, getContext().getPackageName()); - } - } - - public void removeGeofences(PendingIntent pendingIntent, IGeofencerCallbacks callbacks) throws RemoteException { - if (nativeLocation != null) { - nativeLocation.removeGeofences(pendingIntent, callbacks); - } else { - getServiceInterface().removeGeofencesByIntent(pendingIntent, callbacks, getContext().getPackageName()); - } - } - - public Location getLastLocation() throws RemoteException { - Log.d(TAG, "getLastLocation()"); - if (nativeLocation != null) { - return nativeLocation.getLastLocation(); - } else { - return getServiceInterface().getLastLocation(); - } - } - - public void requestLocationUpdates(LocationRequest request, final LocationListener listener) - throws RemoteException { - if (nativeLocation != null) { - nativeLocation.requestLocationUpdates(request, listener); - } else { - if (!listenerMap.containsKey(listener)) { - listenerMap.put(listener, new ILocationListener.Stub() { - @Override - public void onLocationChanged(Location location) throws RemoteException { - listener.onLocationChanged(location); - } - }); - } - getServiceInterface().requestLocationUpdatesWithPackage(request, - listenerMap.get(listener), getContext().getPackageName()); - } - } - - public void requestLocationUpdates(LocationRequest request, PendingIntent pendingIntent) - throws RemoteException { - if (nativeLocation != null) { - nativeLocation.requestLocationUpdates(request, pendingIntent); - } else { - getServiceInterface().requestLocationUpdatesWithIntent(request, pendingIntent); - } - } - - public void requestLocationUpdates(LocationRequest request, LocationListener listener, - Looper looper) throws RemoteException { - if (nativeLocation != null) { - nativeLocation.requestLocationUpdates(request, listener, looper); - } - requestLocationUpdates(request, listener); // TODO - } - - public void removeLocationUpdates(LocationListener listener) throws RemoteException { - if (nativeLocation != null) { - nativeLocation.removeLocationUpdates(listener); - } else { - getServiceInterface().removeLocationUpdatesWithListener(listenerMap.get(listener)); - } - } - - public void removeLocationUpdates(PendingIntent pendingIntent) throws RemoteException { - if (nativeLocation != null) { - nativeLocation.removeLocationUpdates(pendingIntent); - } else { - getServiceInterface().removeLocationUpdatesWithIntent(pendingIntent); - } - } - - public void setMockMode(boolean isMockMode) throws RemoteException { - if (nativeLocation != null) { - nativeLocation.setMockMode(isMockMode); - } else { - getServiceInterface().setMockMode(isMockMode); - } - } - - public void setMockLocation(Location mockLocation) throws RemoteException { - if (nativeLocation != null) { - nativeLocation.setMockLocation(mockLocation); - } else { - getServiceInterface().setMockLocation(mockLocation); - } - } - - @Override - public void handleConnectionFailed() { - // DO NOT call super here, because fails are not really problems :) - nativeLocation = new NativeLocationClientImpl(this); - state = ConnectionState.PSEUDO_CONNECTED; - Bundle bundle = new Bundle(); - bundle.putBoolean("fallback_to_native_active", true); - callbacks.onConnected(bundle); - } -} diff --git a/play-services-location/src/main/java/org/microg/gms/location/LocationServicesApiBuilder.java b/play-services-location/src/main/java/org/microg/gms/location/LocationServicesApiBuilder.java deleted file mode 100644 index 2e053a81..00000000 --- a/play-services-location/src/main/java/org/microg/gms/location/LocationServicesApiBuilder.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.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 { - @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); - } -} diff --git a/play-services-location/src/main/java/org/microg/gms/location/NativeLocationClientImpl.java b/play-services-location/src/main/java/org/microg/gms/location/NativeLocationClientImpl.java deleted file mode 100644 index 17a017d9..00000000 --- a/play-services-location/src/main/java/org/microg/gms/location/NativeLocationClientImpl.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.location; - -import android.app.PendingIntent; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.location.Criteria; -import android.location.Location; -import android.location.LocationManager; -import android.os.Bundle; -import android.os.Looper; -import android.os.RemoteException; -import android.os.SystemClock; -import android.util.Log; - -import com.google.android.gms.common.api.CommonStatusCodes; -import com.google.android.gms.location.FusedLocationProviderApi; -import com.google.android.gms.location.Geofence; -import com.google.android.gms.location.GeofenceStatusCodes; -import com.google.android.gms.location.GeofencingEvent; -import com.google.android.gms.location.GeofencingRequest; -import com.google.android.gms.location.LocationListener; -import com.google.android.gms.location.LocationRequest; -import com.google.android.gms.location.internal.IGeofencerCallbacks; -import com.google.android.gms.location.internal.ParcelableGeofence; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static android.location.LocationManager.KEY_LOCATION_CHANGED; -import static android.location.LocationManager.KEY_PROXIMITY_ENTERING; - -@SuppressWarnings("MissingPermission") -public class NativeLocationClientImpl { - private final static String TAG = "GmsToNativeLocClient"; - private final static Criteria DEFAULT_CRITERIA = new Criteria(); - private final static Map pendingCount = new HashMap(); - private final static Map nativePendingMap = new HashMap(); - private static final String EXTRA_PENDING_INTENT = "pending_intent"; - - private final Context context; - private final LocationManager locationManager; - private final Map nativeListenerMap = new HashMap(); - - public NativeLocationClientImpl(LocationClientImpl client) { - context = client.getContext(); - locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); - } - - private static Criteria makeNativeCriteria(LocationRequest request) { - Criteria criteria = new Criteria(); - switch (request.getPriority()) { - case LocationRequest.PRIORITY_HIGH_ACCURACY: - criteria.setAccuracy(Criteria.ACCURACY_FINE); - criteria.setPowerRequirement(Criteria.POWER_HIGH); - break; - case LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY: - default: - criteria.setAccuracy(Criteria.ACCURACY_COARSE); - criteria.setPowerRequirement(Criteria.POWER_MEDIUM); - break; - case LocationRequest.PRIORITY_NO_POWER: - case LocationRequest.PRIORITY_LOW_POWER: - criteria.setAccuracy(Criteria.ACCURACY_COARSE); - criteria.setPowerRequirement(Criteria.POWER_LOW); - } - return criteria; - } - - public void addGeofences(GeofencingRequest geofencingRequest, PendingIntent pendingIntent, IGeofencerCallbacks callbacks) throws RemoteException { - Log.d(TAG, "addGeofences(GeofencingRequest)"); - callbacks.onAddGeofenceResult(GeofenceStatusCodes.GEOFENCE_NOT_AVAILABLE, new String[0]); - } - - public void addGeofences(List geofences, PendingIntent pendingIntent, IGeofencerCallbacks callbacks) throws RemoteException { - Log.d(TAG, "addGeofences(List)"); - Intent i = new Intent(context, NativePendingIntentForwarder.class); - Bundle bundle = new Bundle(); - bundle.putParcelable(EXTRA_PENDING_INTENT, pendingIntent); - i.putExtras(bundle); - nativePendingMap.put(pendingIntent, PendingIntent.getActivity(context, 0, i, 0)); - List requestIds = new ArrayList(); - for (ParcelableGeofence geofence : geofences) { - locationManager.addProximityAlert(geofence.latitude, geofence.longitude, geofence.radius, - geofence.expirationTime - SystemClock.elapsedRealtime(), nativePendingMap.get(pendingIntent)); - requestIds.add(geofence.getRequestId()); - } - callbacks.onAddGeofenceResult(CommonStatusCodes.SUCCESS, requestIds.toArray(new String[requestIds.size()])); - } - - public void removeGeofences(List requestIds, IGeofencerCallbacks callbacks) throws RemoteException { - Log.d(TAG, "removeGeofences(List)"); - callbacks.onRemoveGeofencesByRequestIdsResult(GeofenceStatusCodes.ERROR, requestIds.toArray(new String[requestIds.size()])); - } - - public void removeGeofences(PendingIntent pendingIntent, IGeofencerCallbacks callbacks) throws RemoteException { - Log.d(TAG, "removeGeofences(PendingIntent)"); - locationManager.removeProximityAlert(nativePendingMap.get(pendingIntent)); - nativePendingMap.remove(pendingIntent); - callbacks.onRemoveGeofencesByPendingIntentResult(CommonStatusCodes.SUCCESS, pendingIntent); - } - - public Location getLastLocation() { - Log.d(TAG, "getLastLocation()"); - return locationManager.getLastKnownLocation(locationManager.getBestProvider(DEFAULT_CRITERIA, true)); - } - - public void requestLocationUpdates(LocationRequest request, LocationListener listener) { - requestLocationUpdates(request, listener, Looper.getMainLooper()); - } - - public void requestLocationUpdates(LocationRequest request, PendingIntent pendingIntent) { - Log.d(TAG, "requestLocationUpdates()"); - Intent i = new Intent(context, NativePendingIntentForwarder.class); - Bundle bundle = new Bundle(); - bundle.putParcelable(EXTRA_PENDING_INTENT, pendingIntent); - i.putExtras(bundle); - pendingCount.put(pendingIntent, request.getNumUpdates()); - nativePendingMap.put(pendingIntent, PendingIntent.getActivity(context, 0, i, 0)); - locationManager.requestLocationUpdates(request.getInterval(), request.getSmallestDesplacement(), - makeNativeCriteria(request), nativePendingMap.get(pendingIntent)); - } - - public void requestLocationUpdates(LocationRequest request, LocationListener listener, Looper - looper) { - Log.d(TAG, "requestLocationUpdates()"); - if (nativeListenerMap.containsKey(listener)) { - removeLocationUpdates(listener); - } - nativeListenerMap.put(listener, new NativeListener(listener, request.getNumUpdates())); - locationManager.requestLocationUpdates(request.getInterval(), - request.getSmallestDesplacement(), makeNativeCriteria(request), - nativeListenerMap.get(listener), looper); - } - - public void removeLocationUpdates(LocationListener listener) { - Log.d(TAG, "removeLocationUpdates()"); - locationManager.removeUpdates(nativeListenerMap.get(listener)); - nativeListenerMap.remove(listener); - } - - public void removeLocationUpdates(PendingIntent pendingIntent) { - Log.d(TAG, "removeLocationUpdates()"); - locationManager.removeUpdates(nativePendingMap.get(pendingIntent)); - nativePendingMap.remove(pendingIntent); - pendingCount.remove(pendingIntent); - } - - public void setMockMode(boolean isMockMode) { - Log.d(TAG, "setMockMode()"); - // not yet supported - } - - public void setMockLocation(Location mockLocation) { - Log.d(TAG, "setMockLocation()"); - // not yet supported - } - - public static class NativePendingIntentForwarder extends BroadcastReceiver { - - @Override - public void onReceive(Context context, Intent intent) { - if (intent.hasExtra(KEY_PROXIMITY_ENTERING)) { - PendingIntent pendingIntent = intent.getExtras().getParcelable(EXTRA_PENDING_INTENT); - try { - intent.putExtra(GeofencingEvent.EXTRA_TRANSITION, intent.getBooleanExtra(KEY_PROXIMITY_ENTERING, false) ? Geofence.GEOFENCE_TRANSITION_ENTER : Geofence.GEOFENCE_TRANSITION_EXIT); - pendingIntent.send(context, 0, intent); - } catch (PendingIntent.CanceledException e) { - nativePendingMap.remove(pendingIntent); - } - } else if (intent.hasExtra(KEY_LOCATION_CHANGED)) { - PendingIntent pendingIntent = intent.getExtras().getParcelable(EXTRA_PENDING_INTENT); - try { - intent.putExtra(FusedLocationProviderApi.KEY_LOCATION_CHANGED, - intent.getParcelableExtra(KEY_LOCATION_CHANGED)); - pendingIntent.send(context, 0, intent); - pendingCount.put(pendingIntent, pendingCount.get(pendingIntent) - 1); - if (pendingCount.get(pendingIntent) == 0) { - ((LocationManager) context.getSystemService(Context.LOCATION_SERVICE)) - .removeUpdates(nativePendingMap.get(pendingIntent)); - nativePendingMap.remove(pendingIntent); - pendingCount.remove(pendingIntent); - } - } catch (PendingIntent.CanceledException e) { - ((LocationManager) context.getSystemService(Context.LOCATION_SERVICE)) - .removeUpdates(nativePendingMap.get(pendingIntent)); - nativePendingMap.remove(pendingIntent); - pendingCount.remove(pendingIntent); - } - } - } - } - - public class NativeListener implements android.location.LocationListener { - - private final LocationListener listener; - private int count; - - private NativeListener(LocationListener listener, int count) { - this.listener = listener; - this.count = count; - } - - @Override - public void onLocationChanged(Location location) { - listener.onLocationChanged(location); - count--; - if (count == 0) { - locationManager.removeUpdates(this); - nativeListenerMap.remove(listener); - } - } - - @Override - public void onStatusChanged(String provider, int status, Bundle extras) { - - } - - @Override - public void onProviderEnabled(String provider) { - - } - - @Override - public void onProviderDisabled(String provider) { - - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - NativeListener that = (NativeListener) o; - - if (!listener.equals(that.listener)) return false; - - return true; - } - - @Override - public int hashCode() { - return listener.hashCode(); - } - } -} diff --git a/play-services-location/src/main/java/org/microg/gms/location/SettingsApiImpl.java b/play-services-location/src/main/java/org/microg/gms/location/SettingsApiImpl.java deleted file mode 100644 index b8fe0ffe..00000000 --- a/play-services-location/src/main/java/org/microg/gms/location/SettingsApiImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2017 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.location; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.PendingResult; -import com.google.android.gms.common.api.Status; -import com.google.android.gms.location.LocationSettingsRequest; -import com.google.android.gms.location.LocationSettingsResult; -import com.google.android.gms.location.SettingsApi; - -import org.microg.gms.common.api.InstantPendingResult; - -public class SettingsApiImpl implements SettingsApi { - @Override - public PendingResult checkLocationSettings(GoogleApiClient client, LocationSettingsRequest locationSettingsRequest) { - return new InstantPendingResult(new LocationSettingsResult(Status.CANCELED)); - } -} diff --git a/play-services-maps-core-mapbox/build.gradle b/play-services-maps-core-mapbox/build.gradle deleted file mode 100644 index 8ae75a48..00000000 --- a/play-services-maps-core-mapbox/build.gradle +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2013-2019 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. - */ - -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' - -dependencies { - implementation project(':play-services-api') - implementation("com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.1") { - exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-accounts' - } - implementation("com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.8.0") { - exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-accounts' - } - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" -} - -def execResult(...args) { - def stdout = new ByteArrayOutputStream() - exec { - commandLine args - standardOutput = stdout - } - return stdout.toString().trim() -} - -def mapboxKey() { - Properties properties = new Properties() - properties.load(project.rootProject.file('local.properties').newDataInputStream()) - return properties.getProperty("mapbox.key", "invalid") -} - -android { - compileSdkVersion androidCompileSdk - buildToolsVersion "$androidBuildVersionTools" - - defaultConfig { - versionName version - minSdkVersion androidMinSdk - targetSdkVersion androidTargetSdk - buildConfigField "String", "MAPBOX_KEY", "\"${mapboxKey()}\"" - - ndk { - abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86", "x86_64" - } - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - lintOptions { - disable 'GradleCompatible' - } - - buildTypes { - release { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } -} - -if (file('user.gradle').exists()) { - apply from: 'user.gradle' -} diff --git a/play-services-maps-core-mapbox/src/main/AndroidManifest.xml b/play-services-maps-core-mapbox/src/main/AndroidManifest.xml deleted file mode 100644 index eef94459..00000000 --- a/play-services-maps-core-mapbox/src/main/AndroidManifest.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/play-services-maps-core-mapbox/src/main/java/com/google/android/gms/maps/internal/CreatorImpl.java b/play-services-maps-core-mapbox/src/main/java/com/google/android/gms/maps/internal/CreatorImpl.java deleted file mode 100644 index 905015ba..00000000 --- a/play-services-maps-core-mapbox/src/main/java/com/google/android/gms/maps/internal/CreatorImpl.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.internal; - -import android.app.Activity; -import android.content.Context; -import android.content.res.Resources; -import android.os.Parcel; -import android.os.RemoteException; -import androidx.annotation.Keep; -import android.util.Log; - -import com.google.android.gms.dynamic.IObjectWrapper; -import com.google.android.gms.dynamic.ObjectWrapper; -import com.google.android.gms.maps.GoogleMapOptions; -import com.google.android.gms.maps.model.internal.IBitmapDescriptorFactoryDelegate; - -import org.microg.gms.maps.mapbox.CameraUpdateFactoryImpl; -import org.microg.gms.maps.mapbox.MapFragmentImpl; -import org.microg.gms.maps.mapbox.MapViewImpl; -import org.microg.gms.maps.mapbox.model.BitmapDescriptorFactoryImpl; - -@Keep -public class CreatorImpl extends ICreator.Stub { - private static final String TAG = "GmsMapCreator"; - - @Override - public void init(IObjectWrapper resources) { - initV2(resources, 0); - } - - @Override - public IMapFragmentDelegate newMapFragmentDelegate(IObjectWrapper activity) { - return new MapFragmentImpl(ObjectWrapper.unwrapTyped(activity, Activity.class)); - } - - @Override - public IMapViewDelegate newMapViewDelegate(IObjectWrapper context, GoogleMapOptions options) { - return new MapViewImpl(ObjectWrapper.unwrapTyped(context, Context.class), options); - } - - @Override - public ICameraUpdateFactoryDelegate newCameraUpdateFactoryDelegate() { - return new CameraUpdateFactoryImpl(); - } - - @Override - public IBitmapDescriptorFactoryDelegate newBitmapDescriptorFactoryDelegate() { - return BitmapDescriptorFactoryImpl.INSTANCE; - } - - @Override - public void initV2(IObjectWrapper resources, int flags) { - BitmapDescriptorFactoryImpl.INSTANCE.initialize(ObjectWrapper.unwrapTyped(resources, Resources.class), null); - //ResourcesContainer.set((Resources) ObjectWrapper.unwrap(resources)); - Log.d(TAG, "initV2 " + flags); - } - - @Override - public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { - if (super.onTransact(code, data, reply, flags)) return true; - Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags); - return false; - } -} diff --git a/play-services-maps-core-mapbox/src/main/java/com/mapbox/android/accounts/v1/MapboxAccounts.java b/play-services-maps-core-mapbox/src/main/java/com/mapbox/android/accounts/v1/MapboxAccounts.java deleted file mode 100644 index 1319a19f..00000000 --- a/play-services-maps-core-mapbox/src/main/java/com/mapbox/android/accounts/v1/MapboxAccounts.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.mapbox.android.accounts.v1; - -import java.util.UUID; - -/** - * This class is used from within the Mapbox library - */ -@SuppressWarnings("unused") -public class MapboxAccounts { - public final static String SKU_ID_MAPS_MAUS = "00"; - private final static String MAPS_SKU_PREFIX = "100"; - - /** - * Generates random UUID without hyphens - */ - public static String obtainEndUserId() { - String uuid = UUID.randomUUID().toString(); - return uuid.substring(0, 8) + uuid.substring(9, 13) + uuid.substring(14, 18) + uuid.substring(19, 23) + uuid.substring(24, 36); - } - - /** - * Generates a SKU which is the user id prefixed with 100 and base-36 encoded timestamp - */ - public static String obtainMapsSkuUserToken(String userId) { - String stamp = Long.toString(System.currentTimeMillis(), 36); - return MAPS_SKU_PREFIX + stamp + userId; - } -} diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/CameraBoundsWithSizeUpdate.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/CameraBoundsWithSizeUpdate.kt deleted file mode 100644 index eea4304f..00000000 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/CameraBoundsWithSizeUpdate.kt +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.mapbox - -import android.util.Log -import com.mapbox.mapboxsdk.camera.CameraPosition -import com.mapbox.mapboxsdk.camera.CameraUpdate -import com.mapbox.mapboxsdk.geometry.LatLngBounds -import com.mapbox.mapboxsdk.maps.MapboxMap -import java.util.* - -internal class CameraBoundsWithSizeUpdate(val bounds: LatLngBounds, val width: Int, val height: Int, val padding: IntArray) : CameraUpdate { - - constructor(bounds: LatLngBounds, width: Int, height: Int, paddingLeft: Int, paddingTop: Int = paddingLeft, paddingRight: Int = paddingLeft, paddingBottom: Int = paddingTop) : this(bounds, width, height, intArrayOf(paddingLeft, paddingTop, paddingRight, paddingBottom)) {} - - override fun getCameraPosition(map: MapboxMap): CameraPosition? { - val padding = this.padding.clone() - val widthPad = ((map.width + map.padding[0] + map.padding[2] - width) / 2).toInt() - val heightPad = ((map.height + map.padding[1] + map.padding[3] - height) / 2).toInt() - padding[0] += widthPad - padding[1] += heightPad - padding[2] += widthPad - padding[3] += heightPad - Log.d(TAG, "map ${map.width} ${map.height}, set $width $height -> ${padding.map { it.toString() }.reduce { a, b -> "$a,$b"}}") - return map.getCameraForLatLngBounds(bounds, padding) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - if (other == null || other !is CameraBoundsWithSizeUpdate?) { - return false - } - - val that = other as CameraBoundsWithSizeUpdate? ?: return false - - if (bounds != that.bounds) { - return false - } - - if (Arrays.equals(padding, that.padding)) { - return false - } - - if (height != that.height || width != that.width) { - return false - } - - return true - } - - override fun hashCode(): Int { - var result = bounds.hashCode() - result = 31 * result + Arrays.hashCode(padding) - result = 31 * result + height.hashCode() - result = 31 * result + width.hashCode() - return result - } - - override fun toString(): String { - return ("CameraBoundsWithSizeUpdate{" - + "bounds=" + bounds - + ", padding=" + Arrays.toString(padding) - + '}'.toString()) - } - - companion object { - const val TAG = "GmsMapCameraBounds" - } -} \ No newline at end of file diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/CameraUpdateFactory.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/CameraUpdateFactory.kt deleted file mode 100644 index 675429b9..00000000 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/CameraUpdateFactory.kt +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.mapbox - -import android.graphics.Point -import android.os.Parcel -import android.util.Log -import com.google.android.gms.dynamic.IObjectWrapper -import com.google.android.gms.dynamic.ObjectWrapper -import com.google.android.gms.maps.internal.ICameraUpdateFactoryDelegate -import com.google.android.gms.maps.model.CameraPosition -import com.google.android.gms.maps.model.LatLng -import com.google.android.gms.maps.model.LatLngBounds -import com.mapbox.mapboxsdk.camera.CameraUpdate -import com.mapbox.mapboxsdk.camera.CameraUpdateFactory -import com.mapbox.mapboxsdk.maps.MapboxMap -import org.microg.gms.maps.mapbox.utils.toMapbox - -class CameraUpdateFactoryImpl : ICameraUpdateFactoryDelegate.Stub() { - - override fun zoomIn(): IObjectWrapper = ObjectWrapper.wrap(CameraUpdateFactory.zoomIn()) - override fun zoomOut(): IObjectWrapper = ObjectWrapper.wrap(CameraUpdateFactory.zoomOut()) - - override fun zoomTo(zoom: Float): IObjectWrapper = - ObjectWrapper.wrap(CameraUpdateFactory.zoomTo(zoom.toDouble() - 1.0)) - - override fun zoomBy(zoomDelta: Float): IObjectWrapper = - ObjectWrapper.wrap(CameraUpdateFactory.zoomBy(zoomDelta.toDouble())) - - override fun zoomByWithFocus(zoomDelta: Float, x: Int, y: Int): IObjectWrapper = - ObjectWrapper.wrap(CameraUpdateFactory.zoomBy(zoomDelta.toDouble(), Point(x, y))) - - override fun newCameraPosition(cameraPosition: CameraPosition): IObjectWrapper = - ObjectWrapper.wrap(CameraUpdateFactory.newCameraPosition(cameraPosition.toMapbox())) - - override fun newLatLng(latLng: LatLng): IObjectWrapper = - ObjectWrapper.wrap(CameraUpdateFactory.newLatLng(latLng.toMapbox())) - - override fun newLatLngZoom(latLng: LatLng, zoom: Float): IObjectWrapper = - ObjectWrapper.wrap(CameraUpdateFactory.newLatLngZoom(latLng.toMapbox(), zoom.toDouble() - 1.0)) - - override fun newLatLngBounds(bounds: LatLngBounds, padding: Int): IObjectWrapper = - ObjectWrapper.wrap(CameraUpdateFactory.newLatLngBounds(bounds.toMapbox(), padding)) - - override fun scrollBy(x: Float, y: Float): IObjectWrapper { - Log.d(TAG, "unimplemented Method: scrollBy") - return ObjectWrapper.wrap(NoCameraUpdate()) - } - - override fun newLatLngBoundsWithSize(bounds: LatLngBounds, width: Int, height: Int, padding: Int): IObjectWrapper = - ObjectWrapper.wrap(CameraBoundsWithSizeUpdate(bounds.toMapbox(), width, height, padding)) - - override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean = - if (super.onTransact(code, data, reply, flags)) { - true - } else { - Log.d(TAG, "onTransact [unknown]: $code, $data, $flags"); false - } - - private inner class NoCameraUpdate : CameraUpdate { - override fun getCameraPosition(mapboxMap: MapboxMap): com.mapbox.mapboxsdk.camera.CameraPosition? = - mapboxMap.cameraPosition - } - - companion object { - private val TAG = "GmsCameraUpdate" - } -} - - diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/GoogleMap.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/GoogleMap.kt deleted file mode 100644 index ffc854b8..00000000 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/GoogleMap.kt +++ /dev/null @@ -1,775 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.mapbox - -import android.annotation.SuppressLint -import android.app.Activity -import android.content.Context -import android.location.Location -import android.os.* -import androidx.annotation.IdRes -import androidx.annotation.Keep -import android.util.DisplayMetrics -import android.util.Log -import android.view.Gravity -import android.view.View -import android.widget.FrameLayout -import android.widget.RelativeLayout -import androidx.collection.LongSparseArray -import com.google.android.gms.dynamic.IObjectWrapper -import com.google.android.gms.maps.GoogleMapOptions -import com.google.android.gms.maps.internal.* -import com.google.android.gms.maps.model.* -import com.google.android.gms.maps.model.CircleOptions -import com.google.android.gms.maps.model.internal.* -import com.mapbox.mapboxsdk.LibraryLoader -import com.mapbox.mapboxsdk.Mapbox -import com.mapbox.mapboxsdk.R -import com.mapbox.mapboxsdk.camera.CameraUpdate -import com.mapbox.mapboxsdk.constants.MapboxConstants -import com.mapbox.mapboxsdk.maps.MapView -import com.mapbox.mapboxsdk.maps.MapboxMap -import com.mapbox.mapboxsdk.maps.Style -import com.mapbox.mapboxsdk.plugins.annotation.* -import com.mapbox.mapboxsdk.plugins.annotation.Annotation -import com.mapbox.mapboxsdk.style.layers.Property.LINE_CAP_ROUND -import com.mapbox.mapboxsdk.utils.ColorUtils -import com.mapbox.mapboxsdk.utils.ThreadUtils -import org.microg.gms.kotlin.unwrap -import org.microg.gms.maps.MapsConstants.* -import org.microg.gms.maps.mapbox.model.* -import org.microg.gms.maps.mapbox.utils.MapContext -import org.microg.gms.maps.mapbox.utils.MultiArchLoader -import org.microg.gms.maps.mapbox.utils.toGms -import org.microg.gms.maps.mapbox.utils.toMapbox - -private fun LongSparseArray.values() = (0..size()).map { valueAt(it) }.mapNotNull { it } - -fun runOnMainLooper(method: () -> Unit) { - if (Looper.myLooper() == Looper.getMainLooper()) { - method() - } else { - Handler(Looper.getMainLooper()).post { - method() - } - } -} - -class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions) : IGoogleMapDelegate.Stub() { - - val view: FrameLayout - var map: MapboxMap? = null - private set - val dpiFactor: Float - get() = context.resources.displayMetrics.densityDpi.toFloat() / DisplayMetrics.DENSITY_DEFAULT - - private var mapView: MapView? = null - private var created = false - private var initialized = false - private var loaded = false - private val mapLock = Object() - - private val initializedCallbackList = mutableListOf() - private var loadedCallback: IOnMapLoadedCallback? = null - private var cameraChangeListener: IOnCameraChangeListener? = null - private var cameraMoveListener: IOnCameraMoveListener? = null - private var cameraMoveCanceledListener: IOnCameraMoveCanceledListener? = null - private var cameraMoveStartedListener: IOnCameraMoveStartedListener? = null - private var cameraIdleListener: IOnCameraIdleListener? = null - private var mapClickListener: IOnMapClickListener? = null - private var mapLongClickListener: IOnMapLongClickListener? = null - private var markerClickListener: IOnMarkerClickListener? = null - private var markerDragListener: IOnMarkerDragListener? = null - - var lineManager: LineManager? = null - val pendingLines = mutableSetOf() - var lineId = 0L - - var fillManager: FillManager? = null - val pendingFills = mutableSetOf() - var fillId = 0L - - var circleManager: CircleManager? = null - val pendingCircles = mutableSetOf() - var circleId = 0L - - var symbolManager: SymbolManager? = null - val pendingMarkers = mutableSetOf() - val markers = mutableMapOf() - var markerId = 0L - - var storedMapType: Int = options.mapType - val waitingCameraUpdates = mutableListOf() - - init { - val mapContext = MapContext(context) - BitmapDescriptorFactoryImpl.initialize(mapContext.resources, context.resources) - LibraryLoader.setLibraryLoader(MultiArchLoader(mapContext, context)) - runOnMainLooper { - Mapbox.getInstance(mapContext, BuildConfig.MAPBOX_KEY) - } - - - val fakeWatermark = View(mapContext) - fakeWatermark.layoutParams = object : RelativeLayout.LayoutParams(0, 0) { - @SuppressLint("RtlHardcoded") - override fun addRule(verb: Int, subject: Int) { - super.addRule(verb, subject) - val rules = this.rules - var gravity = 0 - if (rules[RelativeLayout.ALIGN_PARENT_BOTTOM] == RelativeLayout.TRUE) gravity = gravity or Gravity.BOTTOM - if (rules[RelativeLayout.ALIGN_PARENT_TOP] == RelativeLayout.TRUE) gravity = gravity or Gravity.TOP - if (rules[RelativeLayout.ALIGN_PARENT_LEFT] == RelativeLayout.TRUE) gravity = gravity or Gravity.LEFT - if (rules[RelativeLayout.ALIGN_PARENT_RIGHT] == RelativeLayout.TRUE) gravity = gravity or Gravity.RIGHT - if (rules[RelativeLayout.ALIGN_PARENT_START] == RelativeLayout.TRUE) gravity = gravity or Gravity.START - if (rules[RelativeLayout.ALIGN_PARENT_END] == RelativeLayout.TRUE) gravity = gravity or Gravity.END - map?.uiSettings?.logoGravity = gravity - } - } - this.view = object : FrameLayout(mapContext) { - @Keep - fun findViewTraversal(@IdRes id: Int): T? { - return null - } - - @Keep - fun findViewWithTagTraversal(tag: Any): T? { - if ("GoogleWatermark" == tag) { - return try { - @Suppress("UNCHECKED_CAST") - fakeWatermark as T - } catch (e: ClassCastException) { - null - } - } - return null - } - } - } - - override fun getCameraPosition(): CameraPosition? = map?.cameraPosition?.toGms() - override fun getMaxZoomLevel(): Float = (map?.maxZoomLevel?.toFloat() ?: 20f) + 1f - override fun getMinZoomLevel(): Float = (map?.minZoomLevel?.toFloat() ?: 0f) + 1f - - override fun moveCamera(cameraUpdate: IObjectWrapper?) { - val update = cameraUpdate.unwrap() ?: return - synchronized(mapLock) { - if (initialized) { - this.map?.moveCamera(update) - } else { - waitingCameraUpdates.add(update) - } - } - } - - override fun animateCamera(cameraUpdate: IObjectWrapper?) { - val update = cameraUpdate.unwrap() ?: return - synchronized(mapLock) { - if (initialized) { - this.map?.animateCamera(update) - } else { - waitingCameraUpdates.add(update) - } - } - } - - fun afterInitialized(runnable: () -> Unit) { - initializedCallbackList.add(object : IOnMapReadyCallback { - override fun onMapReady(map: IGoogleMapDelegate?) { - runnable() - } - - override fun asBinder(): IBinder? = null - }) - } - - override fun animateCameraWithCallback(cameraUpdate: IObjectWrapper?, callback: ICancelableCallback?) { - val update = cameraUpdate.unwrap() ?: return - synchronized(mapLock) { - if (initialized) { - this.map?.animateCamera(update, callback?.toMapbox()) - } else { - waitingCameraUpdates.add(update) - afterInitialized { callback?.onFinish() } - } - } - } - - override fun animateCameraWithDurationAndCallback(cameraUpdate: IObjectWrapper?, duration: Int, callback: ICancelableCallback?) { - val update = cameraUpdate.unwrap() ?: return - synchronized(mapLock) { - if (initialized) { - this.map?.animateCamera(update, duration, callback?.toMapbox()) - } else { - waitingCameraUpdates.add(update) - afterInitialized { callback?.onFinish() } - } - } - } - - override fun stopAnimation() = map?.cancelTransitions() ?: Unit - - override fun setMinZoomPreference(minZoom: Float) { - map?.setMinZoomPreference(minZoom.toDouble() - 1) - } - - override fun setMaxZoomPreference(maxZoom: Float) { - map?.setMaxZoomPreference(maxZoom.toDouble() - 1) - } - - override fun resetMinMaxZoomPreference() { - map?.setMinZoomPreference(MapboxConstants.MINIMUM_ZOOM.toDouble()) - map?.setMaxZoomPreference(MapboxConstants.MAXIMUM_ZOOM.toDouble()) - } - - override fun setLatLngBoundsForCameraTarget(bounds: LatLngBounds?) { - map?.setLatLngBoundsForCameraTarget(bounds?.toMapbox()) - } - - override fun addPolyline(options: PolylineOptions): IPolylineDelegate? { - val line = PolylineImpl(this, "l${lineId++}", options) - synchronized(this) { - val lineManager = lineManager - if (lineManager == null) { - pendingLines.add(line) - } else { - line.update(lineManager) - } - } - return line - } - - - override fun addPolygon(options: PolygonOptions): IPolygonDelegate? { - val fill = PolygonImpl(this, "p${fillId++}", options) - synchronized(this) { - val fillManager = fillManager - if (fillManager == null) { - pendingFills.add(fill) - } else { - fill.update(fillManager) - } - } - return fill - } - - override fun addMarker(options: MarkerOptions): IMarkerDelegate? { - val marker = MarkerImpl(this, "m${markerId++}", options) - synchronized(this) { - val symbolManager = symbolManager - if (symbolManager == null) { - pendingMarkers.add(marker) - } else { - marker.update(symbolManager) - } - } - return marker - } - - override fun addGroundOverlay(options: GroundOverlayOptions): IGroundOverlayDelegate? { - Log.d(TAG, "unimplemented Method: addGroundOverlay") - return null - } - - override fun addTileOverlay(options: TileOverlayOptions): ITileOverlayDelegate? { - Log.d(TAG, "unimplemented Method: addTileOverlay") - return null - } - - override fun addCircle(options: CircleOptions): ICircleDelegate? { - val circle = CircleImpl(this, "c${circleId++}", options) - synchronized(this) { - val circleManager = circleManager - if (circleManager == null) { - pendingCircles.add(circle) - } else { - circle.update(circleManager) - } - } - return circle - } - - override fun clear() { - circleManager?.let { clear(it) } - lineManager?.let { clear(it) } - fillManager?.let { clear(it) } - symbolManager?.let { clear(it) } - } - - fun > clear(manager: AnnotationManager<*, T, *, *, *, *>) { - val annotations = manager.getAnnotations() - for (i in 0..annotations.size()) { - val key = annotations.keyAt(i) - val value = annotations[key]; - if (value is T) manager.delete(value) - } - } - - override fun getMapType(): Int { - return storedMapType - } - - override fun setMapType(type: Int) { - storedMapType = type - applyMapType() - } - - fun applyMapType() { - val circles = circleManager?.annotations?.values() - val lines = lineManager?.annotations?.values() - val fills = fillManager?.annotations?.values() - val symbols = symbolManager?.annotations?.values() - val update: (Style) -> Unit = { - circles?.let { runCatching { circleManager?.update(it) } } - lines?.let { runCatching { lineManager?.update(it) } } - fills?.let { runCatching { fillManager?.update(it) } } - symbols?.let { runCatching { symbolManager?.update(it) } } - } - - // TODO: Serve map styles locally - when (storedMapType) { - MAP_TYPE_SATELLITE -> map?.setStyle(Style.Builder().fromUrl("mapbox://styles/microg/cjxgloted25ap1ct4uex7m6hi"), update) - MAP_TYPE_TERRAIN -> map?.setStyle(Style.OUTDOORS, update) - MAP_TYPE_HYBRID -> map?.setStyle(Style.Builder().fromUrl("mapbox://styles/microg/cjxgloted25ap1ct4uex7m6hi"), update) - //MAP_TYPE_NONE, MAP_TYPE_NORMAL, - else -> map?.setStyle(Style.Builder().fromUrl("mapbox://styles/microg/cjui4020201oo1fmca7yuwbor"), update) - } - - map?.let { BitmapDescriptorFactoryImpl.registerMap(it) } - - } - - override fun setWatermarkEnabled(watermark: Boolean) { - map?.uiSettings?.isLogoEnabled = watermark - } - - override fun isTrafficEnabled(): Boolean { - Log.d(TAG, "unimplemented Method: isTrafficEnabled") - return false - } - - override fun setTrafficEnabled(traffic: Boolean) { - Log.d(TAG, "unimplemented Method: setTrafficEnabled") - - } - - override fun isIndoorEnabled(): Boolean { - Log.d(TAG, "unimplemented Method: isIndoorEnabled") - return false - } - - override fun setIndoorEnabled(indoor: Boolean) { - Log.d(TAG, "unimplemented Method: setIndoorEnabled") - - } - - override fun isMyLocationEnabled(): Boolean { - Log.d(TAG, "unimplemented Method: isMyLocationEnabled") - return false - } - - override fun setMyLocationEnabled(myLocation: Boolean) { - Log.d(TAG, "unimplemented Method: setMyLocationEnabled") - - } - - override fun getMyLocation(): Location? { - Log.d(TAG, "unimplemented Method: getMyLocation") - return null - } - - override fun setLocationSource(locationSource: ILocationSourceDelegate) { - Log.d(TAG, "unimplemented Method: setLocationSource") - } - - override fun setContentDescription(desc: String?) { - mapView?.contentDescription = desc - } - - override fun getUiSettings(): IUiSettingsDelegate? = map?.uiSettings?.let { UiSettingsImpl(it) } - - override fun getProjection(): IProjectionDelegate? = map?.projection?.let { - val experiment = try { - map?.cameraPosition?.tilt == 0.0 && map?.cameraPosition?.bearing == 0.0 - } catch (e: Exception) { - Log.w(TAG, e); false - } - ProjectionImpl(it, experiment) - } - - override fun setOnCameraChangeListener(listener: IOnCameraChangeListener?) { - cameraChangeListener = listener - } - - override fun setOnMapClickListener(listener: IOnMapClickListener?) { - mapClickListener = listener - } - - override fun setOnMapLongClickListener(listener: IOnMapLongClickListener?) { - mapLongClickListener = listener - } - - override fun setOnMarkerClickListener(listener: IOnMarkerClickListener?) { - markerClickListener = listener - } - - override fun setOnMarkerDragListener(listener: IOnMarkerDragListener?) { - markerDragListener = listener - } - - override fun setOnInfoWindowClickListener(listener: IOnInfoWindowClickListener?) { - Log.d(TAG, "unimplemented Method: setOnInfoWindowClickListener") - - } - - override fun setInfoWindowAdapter(adapter: IInfoWindowAdapter?) { - Log.d(TAG, "unimplemented Method: setInfoWindowAdapter") - - } - - override fun getTestingHelper(): IObjectWrapper? { - Log.d(TAG, "unimplemented Method: getTestingHelper") - return null - } - - override fun setOnMyLocationChangeListener(listener: IOnMyLocationChangeListener?) { - Log.d(TAG, "unimplemented Method: setOnMyLocationChangeListener") - - } - - override fun setOnMyLocationButtonClickListener(listener: IOnMyLocationButtonClickListener?) { - Log.d(TAG, "unimplemented Method: setOnMyLocationButtonClickListener") - - } - - override fun snapshot(callback: ISnapshotReadyCallback, bitmap: IObjectWrapper) { - Log.d(TAG, "unimplemented Method: snapshot") - - } - - override fun setPadding(left: Int, top: Int, right: Int, bottom: Int) { - Log.d(TAG, "setPadding: $left $top $right $bottom") - map?.let { map -> - map.setPadding(left, top, right, bottom) - val fourDp = mapView?.context?.resources?.getDimension(R.dimen.mapbox_four_dp)?.toInt() - ?: 0 - val ninetyTwoDp = mapView?.context?.resources?.getDimension(R.dimen.mapbox_ninety_two_dp)?.toInt() - ?: 0 - map.uiSettings.setLogoMargins(left + fourDp, top + fourDp, right + fourDp, bottom + fourDp) - map.uiSettings.setCompassMargins(left + fourDp, top + fourDp, right + fourDp, bottom + fourDp) - map.uiSettings.setAttributionMargins(left + ninetyTwoDp, top + fourDp, right + fourDp, bottom + fourDp) - } - } - - override fun isBuildingsEnabled(): Boolean { - Log.d(TAG, "unimplemented Method: isBuildingsEnabled") - return false - } - - override fun setBuildingsEnabled(buildings: Boolean) { - Log.d(TAG, "unimplemented Method: setBuildingsEnabled") - - } - - override fun setOnMapLoadedCallback(callback: IOnMapLoadedCallback?) { - if (callback != null) { - synchronized(mapLock) { - if (loaded) { - Log.d(TAG, "Invoking callback instantly, as map is loaded") - try { - callback.onMapLoaded() - } catch (e: Exception) { - Log.w(TAG, e) - } - } else { - Log.d(TAG, "Delay callback invocation, as map is not yet loaded") - loadedCallback = callback - } - } - } else { - loadedCallback = null - } - } - - override fun setCameraMoveStartedListener(listener: IOnCameraMoveStartedListener?) { - cameraMoveStartedListener = listener - } - - override fun setCameraMoveListener(listener: IOnCameraMoveListener?) { - cameraMoveListener = listener - } - - override fun setCameraMoveCanceledListener(listener: IOnCameraMoveCanceledListener?) { - cameraMoveCanceledListener = listener - } - - override fun setCameraIdleListener(listener: IOnCameraIdleListener?) { - cameraIdleListener = listener - } - - override fun onCreate(savedInstanceState: Bundle?) { - if (!created) { - Log.d(TAG, "create"); - val mapView = MapView(MapContext(context)) - this.mapView = mapView - view.addView(mapView) - mapView.onCreate(savedInstanceState?.toMapbox()) - mapView.getMapAsync(this::initMap) - created = true - } - } - - private fun hasSymbolAt(latlng: com.mapbox.mapboxsdk.geometry.LatLng): Boolean { - val point = map?.projection?.toScreenLocation(latlng) ?: return false - val features = map?.queryRenderedFeatures(point, symbolManager?.layerId) - ?: return false - return features.isNotEmpty() - } - - private fun initMap(map: MapboxMap) { - if (this.map != null) return - this.map = map - - map.addOnCameraIdleListener { - try { - cameraChangeListener?.onCameraChange(map.cameraPosition.toGms()) - } catch (e: Exception) { - Log.w(TAG, e) - } - } - map.addOnCameraIdleListener { - try { - cameraIdleListener?.onCameraIdle() - } catch (e: Exception) { - Log.w(TAG, e) - } - } - map.addOnCameraMoveListener { - try { - cameraMoveListener?.onCameraMove() - } catch (e: Exception) { - Log.w(TAG, e) - } - } - map.addOnCameraMoveStartedListener { - try { - cameraMoveStartedListener?.onCameraMoveStarted(it) - } catch (e: Exception) { - Log.w(TAG, e) - } - } - map.addOnCameraMoveCancelListener { - try { - cameraMoveCanceledListener?.onCameraMoveCanceled() - } catch (e: Exception) { - Log.w(TAG, e) - } - } - map.addOnMapClickListener { latlng -> - try { - mapClickListener?.let { if (!hasSymbolAt(latlng)) it.onMapClick(latlng.toGms()); } - } catch (e: Exception) { - Log.w(TAG, e) - } - false - } - map.addOnMapLongClickListener { latlng -> - try { - mapLongClickListener?.let { if (!hasSymbolAt(latlng)) it.onMapLongClick(latlng.toGms()); } - } catch (e: Exception) { - Log.w(TAG, e) - } - false - } - - applyMapType() - options.minZoomPreference?.let { if (it != 0f) map.setMinZoomPreference(it.toDouble()) } - options.maxZoomPreference?.let { if (it != 0f) map.setMaxZoomPreference(it.toDouble()) } - options.latLngBoundsForCameraTarget?.let { map.setLatLngBoundsForCameraTarget(it.toMapbox()) } - options.compassEnabled?.let { map.uiSettings.isCompassEnabled = it } - options.rotateGesturesEnabled?.let { map.uiSettings.isRotateGesturesEnabled = it } - options.scrollGesturesEnabled?.let { map.uiSettings.isScrollGesturesEnabled = it } - options.tiltGesturesEnabled?.let { map.uiSettings.isTiltGesturesEnabled = it } - options.camera?.let { map.cameraPosition = it.toMapbox() } - - synchronized(mapLock) { - initialized = true - waitingCameraUpdates.forEach { map.moveCamera(it) } - val initializedCallbackList = ArrayList(initializedCallbackList) - Log.d(TAG, "Invoking ${initializedCallbackList.size} callbacks delayed, as map is initialized") - for (callback in initializedCallbackList) { - try { - callback.onMapReady(this) - } catch (e: Exception) { - Log.w(TAG, e) - } - } - } - - map.getStyle { - mapView?.let { view -> - if (loaded) return@let - val symbolManager: SymbolManager - val lineManager: LineManager - val circleManager: CircleManager - val fillManager: FillManager - - synchronized(mapLock) { - circleManager = CircleManager(view, map, it) - fillManager = FillManager(view, map, it) - symbolManager = SymbolManager(view, map, it) - lineManager = LineManager(view, map, it) - lineManager.lineCap = LINE_CAP_ROUND - - this.symbolManager = symbolManager - this.lineManager = lineManager - this.circleManager = circleManager - this.fillManager = fillManager - } - symbolManager.iconAllowOverlap = true - symbolManager.addClickListener { - try { - markers[it.id]?.let { markerClickListener?.onMarkerClick(it) } - } catch (e: Exception) { - Log.w(TAG, e) - } - } - symbolManager.addDragListener(object : OnSymbolDragListener { - override fun onAnnotationDragStarted(annotation: Symbol?) { - try { - markers[annotation?.id]?.let { markerDragListener?.onMarkerDragStart(it) } - } catch (e: Exception) { - Log.w(TAG, e) - } - } - - override fun onAnnotationDrag(annotation: Symbol?) { - try { - markers[annotation?.id]?.let { markerDragListener?.onMarkerDrag(it) } - } catch (e: Exception) { - Log.w(TAG, e) - } - } - - override fun onAnnotationDragFinished(annotation: Symbol?) { - try { - markers[annotation?.id]?.let { markerDragListener?.onMarkerDragEnd(it) } - } catch (e: Exception) { - Log.w(TAG, e) - } - } - }) - pendingCircles.forEach { it.update(circleManager) } - pendingCircles.clear() - pendingFills.forEach { it.update(fillManager) } - pendingFills.clear() - pendingLines.forEach { it.update(lineManager) } - pendingLines.clear() - pendingMarkers.forEach { it.update(symbolManager) } - pendingMarkers.clear() - - synchronized(mapLock) { - loaded = true - if (loadedCallback != null) { - Log.d(TAG, "Invoking callback delayed, as map is loaded") - loadedCallback?.onMapLoaded() - } - } - } - } - } - - override fun useViewLifecycleWhenInFragment(): Boolean { - Log.d(TAG, "unimplemented Method: useViewLifecycleWhenInFragment") - return false - } - - override fun onResume() = mapView?.onResume() ?: Unit - override fun onPause() = mapView?.onPause() ?: Unit - override fun onDestroy() { - Log.d(TAG, "destroy"); - circleManager?.onDestroy() - circleManager = null - lineManager?.onDestroy() - lineManager = null - fillManager?.onDestroy() - fillManager = null - symbolManager?.onDestroy() - symbolManager = null - pendingMarkers.clear() - markers.clear() - BitmapDescriptorFactoryImpl.unregisterMap(map) - view.removeView(mapView) - // TODO can crash? - mapView?.onDestroy() - mapView = null - map = null - created = false - initialized = false - loaded = false - } - - override fun onStart() { - mapView?.onStart() - } - - override fun onStop() { - mapView?.onStop() - } - - override fun onEnterAmbient(bundle: Bundle?) { - Log.d(TAG, "unimplemented Method: onEnterAmbient") - } - - override fun onExitAmbient() { - Log.d(TAG, "unimplemented Method: onExitAmbient") - } - - override fun onLowMemory() = mapView?.onLowMemory() ?: Unit - override fun onSaveInstanceState(outState: Bundle) { - val newBundle = Bundle() - mapView?.onSaveInstanceState(newBundle) - outState.putAll(newBundle.toGms()) - } - - fun getMapAsync(callback: IOnMapReadyCallback) { - synchronized(mapLock) { - if (initialized) { - Log.d(TAG, "Invoking callback instantly, as map is initialized") - try { - callback.onMapReady(this) - } catch (e: Exception) { - Log.w(TAG, e) - } - } else { - Log.d(TAG, "Delay callback invocation, as map is not yet initialized") - initializedCallbackList.add(callback) - } - } - } - - override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean = - if (super.onTransact(code, data, reply, flags)) { - true - } else { - Log.d(TAG, "onTransact [unknown]: $code, $data, $flags"); false - } - - companion object { - private val TAG = "GmsMap" - } -} diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/MapFragment.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/MapFragment.kt deleted file mode 100644 index daf4bfb9..00000000 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/MapFragment.kt +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.mapbox - -import android.app.Activity -import android.os.Bundle -import android.os.Parcel -import android.util.Base64 -import android.util.Log -import android.view.View -import android.view.ViewGroup -import com.google.android.gms.dynamic.IObjectWrapper -import com.google.android.gms.dynamic.ObjectWrapper -import com.google.android.gms.maps.GoogleMapOptions -import com.google.android.gms.maps.internal.IGoogleMapDelegate -import com.google.android.gms.maps.internal.IMapFragmentDelegate -import com.google.android.gms.maps.internal.IOnMapReadyCallback - -class MapFragmentImpl(private val activity: Activity) : IMapFragmentDelegate.Stub() { - - private var map: GoogleMapImpl? = null - private var options: GoogleMapOptions? = null - - override fun onInflate(activity: IObjectWrapper, options: GoogleMapOptions, savedInstanceState: Bundle?) { - this.options = options - map?.options = options - } - - override fun onCreate(savedInstanceState: Bundle?) { - if (options == null) { - options = savedInstanceState?.getParcelable("MapOptions") - } - if (options == null) { - options = GoogleMapOptions() - } - map = GoogleMapImpl(activity, options ?: GoogleMapOptions()) - } - - override fun onCreateView(layoutInflater: IObjectWrapper, container: IObjectWrapper, savedInstanceState: Bundle?): IObjectWrapper { - if (options == null) { - options = savedInstanceState?.getParcelable("MapOptions") - } - Log.d(TAG, "onCreateView: ${options?.camera?.target}") - if (map == null) { - map = GoogleMapImpl(activity, options ?: GoogleMapOptions()) - } - map!!.onCreate(savedInstanceState) - val view = map!!.view - val parent = view.parent as ViewGroup? - parent?.removeView(view) - return ObjectWrapper.wrap(view) - } - - override fun getMap(): IGoogleMapDelegate? = map - override fun onEnterAmbient(bundle: Bundle?) = map?.onEnterAmbient(bundle) ?: Unit - override fun onExitAmbient() = map?.onExitAmbient() ?: Unit - override fun onStart() = map?.onStart() ?: Unit - override fun onStop() = map?.onStop() ?: Unit - override fun onResume() = map?.onResume() ?: Unit - override fun onPause() = map?.onPause() ?: Unit - override fun onLowMemory() = map?.onLowMemory() ?: Unit - override fun isReady(): Boolean = this.map != null - override fun getMapAsync(callback: IOnMapReadyCallback) = map?.getMapAsync(callback) ?: Unit - - override fun onDestroyView() { - map?.onDestroy() - } - - override fun onDestroy() { - map?.onDestroy() - map = null - options = null - } - - override fun onSaveInstanceState(outState: Bundle) { - if (options != null) { - outState.putParcelable("MapOptions", options) - } - map?.onSaveInstanceState(outState) - } - - override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean { - if (super.onTransact(code, data, reply, flags)) { - return true - } else { - Log.d(TAG, "onTransact [unknown]: $code, $data, $flags") - return false - } - } - - companion object { - private val TAG = "GmsMapFragment" - } -} diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/MapView.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/MapView.kt deleted file mode 100644 index 8951aaf1..00000000 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/MapView.kt +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.mapbox - -import android.content.Context -import android.os.Bundle -import android.os.Parcel -import android.util.Log -import com.google.android.gms.dynamic.IObjectWrapper -import com.google.android.gms.dynamic.ObjectWrapper -import com.google.android.gms.maps.GoogleMapOptions -import com.google.android.gms.maps.internal.IGoogleMapDelegate -import com.google.android.gms.maps.internal.IMapViewDelegate -import com.google.android.gms.maps.internal.IOnMapReadyCallback - -class MapViewImpl(private val context: Context, options: GoogleMapOptions?) : IMapViewDelegate.Stub() { - - private val options: GoogleMapOptions = options ?: GoogleMapOptions() - private var map: GoogleMapImpl? = null - - override fun onCreate(savedInstanceState: Bundle?) { - Log.d(TAG, "onCreate: ${options?.camera?.target}") - map = GoogleMapImpl(context, options) - map!!.onCreate(savedInstanceState) - } - - override fun getMap(): IGoogleMapDelegate? = map - override fun onEnterAmbient(bundle: Bundle?) = map?.onEnterAmbient(bundle) ?: Unit - override fun onExitAmbient() = map?.onExitAmbient() ?: Unit - override fun onStart() = map?.onStart() ?: Unit - override fun onStop() = map?.onStop() ?: Unit - override fun onResume() = map?.onResume() ?: Unit - override fun onPause() = map?.onPause() ?: Unit - override fun onDestroy() { - map?.onDestroy() - map = null - } - - override fun onLowMemory() = map?.onLowMemory() ?: Unit - override fun onSaveInstanceState(outState: Bundle) = map?.onSaveInstanceState(outState) ?: Unit - override fun getView(): IObjectWrapper = ObjectWrapper.wrap(map?.view) - override fun getMapAsync(callback: IOnMapReadyCallback) = map?.getMapAsync(callback) ?: Unit - - override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean = - if (super.onTransact(code, data, reply, flags)) { - true - } else { - Log.d(TAG, "onTransact [unknown]: $code, $data, $flags"); false - } - - companion object { - private val TAG = "GmsMapView" - } -} diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/Projection.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/Projection.kt deleted file mode 100644 index c36e57ed..00000000 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/Projection.kt +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.mapbox - -import android.graphics.Point -import android.graphics.PointF -import android.util.Log -import com.google.android.gms.dynamic.IObjectWrapper -import com.google.android.gms.dynamic.ObjectWrapper -import com.google.android.gms.maps.internal.IProjectionDelegate -import com.google.android.gms.maps.model.LatLng -import com.google.android.gms.maps.model.VisibleRegion -import com.mapbox.mapboxsdk.maps.Projection -import org.microg.gms.kotlin.unwrap -import org.microg.gms.maps.mapbox.utils.toGms -import org.microg.gms.maps.mapbox.utils.toMapbox -import kotlin.math.roundToInt - -// TODO: Do calculations using backed up locations instead of live (which requires UI thread) -class ProjectionImpl(private val projection: Projection, private val withoutTiltOrBearing: Boolean) : IProjectionDelegate.Stub() { - private val visibleRegion = projection.visibleRegion - private val farLeft = projection.toScreenLocation(visibleRegion.farLeft) - private val farRight = projection.toScreenLocation(visibleRegion.farRight) - private val nearLeft = projection.toScreenLocation(visibleRegion.nearLeft) - private val nearRight = projection.toScreenLocation(visibleRegion.nearRight) - - override fun fromScreenLocation(obj: IObjectWrapper?): LatLng? = try { - obj.unwrap()?.let { - if (withoutTiltOrBearing) { - val xPercent = (it.x.toFloat() - farLeft.x) / (farRight.x - farLeft.x) - val yPercent = (it.y.toFloat() - farLeft.y) / (nearLeft.y - farLeft.y) - val lon = visibleRegion.farLeft.longitude + xPercent * (visibleRegion.farRight.longitude - visibleRegion.farLeft.longitude) - val lat = visibleRegion.farLeft.latitude + yPercent * (visibleRegion.nearLeft.latitude - visibleRegion.farLeft.latitude) - LatLng(lat, lon) - } else { - projection.fromScreenLocation(PointF(it)).toGms() - } - } - } catch (e: Exception) { - Log.d(TAG, "fromScreenLocation() used from outside UI thread on map with tilt or bearing, expect bugs") - LatLng(0.0, 0.0) - } - - override fun toScreenLocation(latLng: LatLng?): IObjectWrapper = try { - ObjectWrapper.wrap(latLng?.toMapbox()?.let { - if (withoutTiltOrBearing) { - val xPercent = (it.longitude - visibleRegion.farLeft.longitude) / (visibleRegion.farRight.longitude - visibleRegion.farLeft.longitude) - val yPercent = (it.latitude - visibleRegion.farLeft.latitude) / (visibleRegion.nearLeft.latitude - visibleRegion.farLeft.latitude) - val x = farLeft.x + xPercent * (farRight.x - farLeft.x) - val y = farLeft.y + yPercent * (nearLeft.y - farLeft.y) - Point(x.roundToInt(), y.roundToInt()) - } else { - projection.toScreenLocation(it).let { Point(it.x.roundToInt(), it.y.roundToInt()) } - } - }) - } catch (e: Exception) { - Log.d(TAG, "toScreenLocation() used from outside UI thread on map with tilt or bearing, expect bugs") - ObjectWrapper.wrap(Point(0, 0)) - } - - override fun getVisibleRegion(): VisibleRegion = visibleRegion.toGms() - - companion object { - private val TAG = "GmsMapProjection" - } -} \ No newline at end of file diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/UiSettings.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/UiSettings.kt deleted file mode 100644 index 32320eb4..00000000 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/UiSettings.kt +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.mapbox - -import android.os.Parcel -import android.os.RemoteException -import android.util.Log - -import com.google.android.gms.maps.internal.IUiSettingsDelegate -import com.mapbox.mapboxsdk.maps.UiSettings - -class UiSettingsImpl(private val uiSettings: UiSettings) : IUiSettingsDelegate.Stub() { - - override fun setZoomControlsEnabled(zoom: Boolean) { - Log.d(TAG, "unimplemented Method: setZoomControlsEnabled") - } - - override fun setCompassEnabled(compass: Boolean) { - uiSettings.isCompassEnabled = compass - } - - override fun setMyLocationButtonEnabled(locationButton: Boolean) { - Log.d(TAG, "unimplemented Method: setMyLocationButtonEnabled") - - } - - override fun setScrollGesturesEnabled(scrollGestures: Boolean) { - uiSettings.isScrollGesturesEnabled = scrollGestures - } - - override fun setZoomGesturesEnabled(zoomGestures: Boolean) { - uiSettings.isZoomGesturesEnabled = zoomGestures - } - - override fun setTiltGesturesEnabled(tiltGestures: Boolean) { - uiSettings.isTiltGesturesEnabled = tiltGestures - } - - override fun setRotateGesturesEnabled(rotateGestures: Boolean) { - uiSettings.isRotateGesturesEnabled = rotateGestures - } - - override fun setAllGesturesEnabled(gestures: Boolean) { - uiSettings.setAllGesturesEnabled(gestures) - } - - override fun isZoomControlsEnabled(): Boolean { - Log.d(TAG, "unimplemented Method: isZoomControlsEnabled") - return false - } - - override fun isCompassEnabled(): Boolean = uiSettings.isCompassEnabled - - override fun isMyLocationButtonEnabled(): Boolean { - Log.d(TAG, "unimplemented Method: isMyLocationButtonEnabled") - return false - } - - override fun isScrollGesturesEnabled(): Boolean = uiSettings.isScrollGesturesEnabled - - override fun isZoomGesturesEnabled(): Boolean = uiSettings.isZoomGesturesEnabled - - override fun isTiltGesturesEnabled(): Boolean = uiSettings.isTiltGesturesEnabled - - override fun isRotateGesturesEnabled(): Boolean = uiSettings.isRotateGesturesEnabled - - override fun setIndoorLevelPickerEnabled(indoorLevelPicker: Boolean) { - Log.d(TAG, "unimplemented Method: setIndoorLevelPickerEnabled") - } - - override fun isIndoorLevelPickerEnabled(): Boolean { - Log.d(TAG, "unimplemented Method: isIndoorLevelPickerEnabled") - return false - } - - override fun setMapToolbarEnabled(mapToolbar: Boolean) { - Log.d(TAG, "unimplemented Method: setMapToolbarEnabled") - } - - override fun isMapToolbarEnabled(): Boolean { - Log.d(TAG, "unimplemented Method: isMapToolbarEnabled") - return false - } - - override fun setScrollGesturesEnabledDuringRotateOrZoom(scrollDuringZoom: Boolean) { - Log.d(TAG, "unimplemented Method: setScrollGesturesEnabledDuringRotateOrZoom") - } - - override fun isScrollGesturesEnabledDuringRotateOrZoom(): Boolean { - Log.d(TAG, "unimplemented Method: isScrollGesturesEnabledDuringRotateOrZoom") - return true - } - - override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean = - if (super.onTransact(code, data, reply, flags)) { - true - } else { - Log.d(TAG, "onTransact [unknown]: $code, $data, $flags"); false - } - - companion object { - private val TAG = "GmsMapsUi" - } -} diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/BitmapDescriptor.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/BitmapDescriptor.kt deleted file mode 100644 index e228387d..00000000 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/BitmapDescriptor.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.mapbox.model - -import android.graphics.Color -import android.graphics.PointF -import android.util.Log -import com.mapbox.mapboxsdk.plugins.annotation.Symbol -import com.mapbox.mapboxsdk.plugins.annotation.SymbolOptions -import com.mapbox.mapboxsdk.style.layers.Property.ICON_ANCHOR_TOP_LEFT -import com.mapbox.mapboxsdk.utils.ColorUtils - -open class BitmapDescriptorImpl(private val id: String, private val size: FloatArray) { - open fun applyTo(options: SymbolOptions, anchor: FloatArray, dpiFactor: Float): SymbolOptions { - return options.withIconImage(id).withIconAnchor(ICON_ANCHOR_TOP_LEFT).withIconOffset(arrayOf(-anchor[0] * size[0] / dpiFactor, -anchor[1] * size[1] / dpiFactor)) - } - - open fun applyTo(symbol: Symbol, anchor: FloatArray, dpiFactor: Float) { - symbol.iconAnchor = ICON_ANCHOR_TOP_LEFT - symbol.iconOffset = PointF(-anchor[0] * size[0] / dpiFactor, -anchor[1] * size[1] / dpiFactor) - symbol.iconImage = id - } -} - -class ColorBitmapDescriptorImpl(id: String, size: FloatArray, val hue: Float) : BitmapDescriptorImpl(id, size) { - override fun applyTo(options: SymbolOptions, anchor: FloatArray, dpiFactor: Float): SymbolOptions = super.applyTo(options, anchor, dpiFactor).withIconColor(ColorUtils.colorToRgbaString(Color.HSVToColor(floatArrayOf(hue, 1.0f, 0.5f)))) - override fun applyTo(symbol: Symbol, anchor: FloatArray, dpiFactor: Float) { - super.applyTo(symbol, anchor, dpiFactor) - symbol.setIconColor(Color.HSVToColor(floatArrayOf(hue, 1.0f, 0.5f))) - } -} \ No newline at end of file diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/BitmapDescriptorFactory.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/BitmapDescriptorFactory.kt deleted file mode 100644 index f4f51748..00000000 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/BitmapDescriptorFactory.kt +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.mapbox.model - -import android.content.res.Resources -import android.graphics.* -import android.os.Handler -import android.os.Looper -import android.os.Parcel -import android.util.Log -import com.google.android.gms.dynamic.IObjectWrapper -import com.google.android.gms.dynamic.ObjectWrapper -import com.google.android.gms.maps.model.internal.IBitmapDescriptorFactoryDelegate -import com.mapbox.mapboxsdk.maps.MapboxMap -import org.microg.gms.maps.mapbox.R -import org.microg.gms.maps.mapbox.runOnMainLooper - - -object BitmapDescriptorFactoryImpl : IBitmapDescriptorFactoryDelegate.Stub() { - private val TAG = "GmsMapBitmap" - private var resources: Resources? = null - private var mapResources: Resources? = null - private val maps = hashSetOf() - private val bitmaps = hashMapOf() - - fun initialize(mapResources: Resources?, resources: Resources?) { - BitmapDescriptorFactoryImpl.mapResources = mapResources ?: resources - BitmapDescriptorFactoryImpl.resources = resources ?: mapResources - } - - fun registerMap(map: MapboxMap) { - Log.d(TAG, "registerMap") - map.getStyle { - synchronized(bitmaps) { - it.addImages(bitmaps) - } - } - maps.add(map) - } - - fun unregisterMap(map: MapboxMap?) { - maps.remove(map) - // TODO: cleanup bitmaps? - } - - fun bitmapSize(id: String): FloatArray = - bitmaps[id]?.let { floatArrayOf(it.width.toFloat(), it.height.toFloat()) } - ?: floatArrayOf(0f, 0f) - - private fun registerBitmap(id: String, bitmapCreator: () -> Bitmap?) { - val bitmap: Bitmap = synchronized(bitmaps) { - if (bitmaps.contains(id)) return - val bitmap = bitmapCreator() - if (bitmap == null) { - Log.w(TAG, "Failed to register bitmap $id, creator returned null") - return - } - bitmaps[id] = bitmap - bitmap - } - for (map in maps) { - map.getStyle { - runOnMainLooper { - it.addImage(id, bitmap) - } - } - } - } - - override fun fromResource(resourceId: Int): IObjectWrapper? { - val id = "resource-$resourceId" - registerBitmap(id) { - val bitmap = BitmapFactory.decodeResource(resources, resourceId) - if (bitmap == null) { - try { - Log.d(TAG, "Resource $resourceId not found in $resources (${resources?.getResourceName(resourceId)})") - } catch (e: Resources.NotFoundException) { - Log.d(TAG, "Resource $resourceId not found in $resources") - } - } - bitmap - } - return ObjectWrapper.wrap(BitmapDescriptorImpl(id, bitmapSize(id))) - } - - override fun fromAsset(assetName: String): IObjectWrapper? { - val id = "asset-$assetName" - registerBitmap(id) { resources?.assets?.open(assetName)?.let { BitmapFactory.decodeStream(it) } } - return ObjectWrapper.wrap(BitmapDescriptorImpl(id, bitmapSize(id))) - } - - override fun fromFile(fileName: String): IObjectWrapper? { - val id = "file-$fileName" - registerBitmap(id) { BitmapFactory.decodeFile(fileName) } - return ObjectWrapper.wrap(BitmapDescriptorImpl(id, bitmapSize(id))) - } - - override fun defaultMarker(): IObjectWrapper? { - val id = "marker" - registerBitmap(id) { BitmapFactory.decodeResource(mapResources, R.drawable.maps_default_marker) } - return ObjectWrapper.wrap(BitmapDescriptorImpl(id, bitmapSize(id))) - } - - private fun adjustHue(cm: ColorMatrix, value: Float) { - var value = value - value = cleanValue(value, 180f) / 180f * Math.PI.toFloat() - if (value == 0f) { - return - } - val cosVal = Math.cos(value.toDouble()).toFloat() - val sinVal = Math.sin(value.toDouble()).toFloat() - val lumR = 0.213f - val lumG = 0.715f - val lumB = 0.072f - val mat = floatArrayOf(lumR + cosVal * (1 - lumR) + sinVal * -lumR, lumG + cosVal * -lumG + sinVal * -lumG, lumB + cosVal * -lumB + sinVal * (1 - lumB), 0f, 0f, lumR + cosVal * -lumR + sinVal * 0.143f, lumG + cosVal * (1 - lumG) + sinVal * 0.140f, lumB + cosVal * -lumB + sinVal * -0.283f, 0f, 0f, lumR + cosVal * -lumR + sinVal * -(1 - lumR), lumG + cosVal * -lumG + sinVal * lumG, lumB + cosVal * (1 - lumB) + sinVal * lumB, 0f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 0f, 1f) - cm.postConcat(ColorMatrix(mat)) - } - - private fun cleanValue(p_val: Float, p_limit: Float): Float { - return Math.min(p_limit, Math.max(-p_limit, p_val)) - } - - override fun defaultMarkerWithHue(hue: Float): IObjectWrapper? { - val id = "marker-${hue.toInt()}" - registerBitmap(id) { - val bitmap = BitmapFactory.decodeResource(mapResources, R.drawable.maps_default_marker).copy(Bitmap.Config.ARGB_8888, true) - val paint = Paint() - val matrix = ColorMatrix() - val huex = hue % 360f - adjustHue(matrix, if (huex > 180f) huex - 360f else huex) - paint.setColorFilter(ColorMatrixColorFilter(matrix)) - - val canvas = Canvas(bitmap) - canvas.drawBitmap(bitmap, 0f, 0f, paint) - bitmap - } - return ObjectWrapper.wrap(ColorBitmapDescriptorImpl(id, bitmapSize(id), hue)) - } - - override fun fromBitmap(bitmap: Bitmap): IObjectWrapper? { - val id = "bitmap-${bitmap.hashCode()}" - registerBitmap(id) { bitmap } - return ObjectWrapper.wrap(BitmapDescriptorImpl(id, bitmapSize(id))) - } - - override fun fromPath(absolutePath: String): IObjectWrapper? { - val id = "path-$absolutePath" - registerBitmap(id) { BitmapFactory.decodeFile(absolutePath) } - return ObjectWrapper.wrap(BitmapDescriptorImpl(id, bitmapSize(id))) - } - - override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean = - if (super.onTransact(code, data, reply, flags)) { - true - } else { - Log.d(TAG, "onTransact [unknown]: $code, $data, $flags"); false - } -} diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Circle.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Circle.kt deleted file mode 100644 index aa016ea8..00000000 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Circle.kt +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.mapbox.model - -import android.os.Parcel -import android.util.Log -import com.google.android.gms.maps.model.LatLng -import com.google.android.gms.maps.model.internal.ICircleDelegate -import com.mapbox.mapboxsdk.plugins.annotation.Circle -import com.mapbox.mapboxsdk.plugins.annotation.CircleOptions -import com.mapbox.mapboxsdk.utils.ColorUtils -import org.microg.gms.maps.mapbox.GoogleMapImpl -import org.microg.gms.maps.mapbox.utils.toMapbox -import com.google.android.gms.maps.model.CircleOptions as GmsCircleOptions - -class CircleImpl(private val map: GoogleMapImpl, private val id: String, options: GmsCircleOptions) : ICircleDelegate.Stub(), Markup { - private var center: LatLng = options.center - private var radius: Double = options.radius - private var strokeWidth: Float = options.strokeWidth - private var strokeColor: Int = options.strokeColor - private var fillColor: Int = options.fillColor - private var visible: Boolean = options.isVisible - - override var annotation: Circle? = null - override var removed: Boolean = false - override val annotationOptions: CircleOptions - get() = CircleOptions() - .withLatLng(center.toMapbox()) - .withCircleColor(ColorUtils.colorToRgbaString(fillColor)) - .withCircleRadius(radius.toFloat()) - .withCircleStrokeColor(ColorUtils.colorToRgbaString(strokeColor)) - .withCircleStrokeWidth(strokeWidth / map.dpiFactor) - .withCircleOpacity(if (visible) 1f else 0f) - .withCircleStrokeOpacity(if (visible) 1f else 0f) - - override fun remove() { - removed = true - map.circleManager?.let { update(it) } - } - - override fun getId(): String = id - - override fun setCenter(center: LatLng) { - this.center = center - annotation?.latLng = center.toMapbox() - map.circleManager?.let { update(it) } - } - - override fun getCenter(): LatLng = center - - override fun setRadius(radius: Double) { - this.radius = radius - annotation?.circleRadius = radius.toFloat() - map.circleManager?.let { update(it) } - } - - override fun getRadius(): Double = radius - - override fun setStrokeWidth(width: Float) { - this.strokeWidth = width - annotation?.circleStrokeWidth = width / map.dpiFactor - map.circleManager?.let { update(it) } - } - - override fun getStrokeWidth(): Float = strokeWidth - - override fun setStrokeColor(color: Int) { - this.strokeColor = color - annotation?.setCircleStrokeColor(color) - map.circleManager?.let { update(it) } - } - - override fun getStrokeColor(): Int = strokeColor - - override fun setFillColor(color: Int) { - this.fillColor = color - annotation?.setCircleColor(color) - map.circleManager?.let { update(it) } - } - - override fun getFillColor(): Int = fillColor - - override fun setZIndex(zIndex: Float) { - Log.d(TAG, "unimplemented Method: setZIndex") - } - - override fun getZIndex(): Float { - Log.d(TAG, "unimplemented Method: getZIndex") - return 0f - } - - override fun setVisible(visible: Boolean) { - this.visible = visible - annotation?.circleOpacity = if (visible) 1f else 0f - annotation?.circleStrokeOpacity = if (visible) 1f else 0f - map.circleManager?.let { update(it) } - } - - override fun isVisible(): Boolean = visible - - override fun equalsRemote(other: ICircleDelegate?): Boolean = equals(other) - - override fun hashCodeRemote(): Int = hashCode() - - override fun hashCode(): Int { - return id.hashCode() - } - - override fun toString(): String { - return id - } - - override fun equals(other: Any?): Boolean { - if (other is CircleImpl) { - return other.id == id - } - return false - } - - override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean = - if (super.onTransact(code, data, reply, flags)) { - true - } else { - Log.d(TAG, "onTransact [unknown]: $code, $data, $flags"); false - } - - companion object { - val TAG = "GmsMapCircle" - } -} \ No newline at end of file diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Marker.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Marker.kt deleted file mode 100644 index 981bc860..00000000 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Marker.kt +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.mapbox.model - -import android.util.Log -import com.google.android.gms.dynamic.IObjectWrapper -import com.google.android.gms.maps.model.LatLng -import com.google.android.gms.maps.model.MarkerOptions -import com.google.android.gms.maps.model.internal.IMarkerDelegate -import com.mapbox.mapboxsdk.plugins.annotation.AnnotationManager -import com.mapbox.mapboxsdk.plugins.annotation.Symbol -import com.mapbox.mapboxsdk.plugins.annotation.SymbolOptions -import org.microg.gms.kotlin.unwrap -import org.microg.gms.maps.mapbox.GoogleMapImpl -import org.microg.gms.maps.mapbox.utils.toMapbox - -class MarkerImpl(private val map: GoogleMapImpl, private val id: String, options: MarkerOptions) : IMarkerDelegate.Stub(), Markup { - private var position: LatLng = options.position - private var visible: Boolean = options.isVisible - private var rotation: Float = options.rotation - private var anchor: FloatArray = floatArrayOf(options.anchorU, options.anchorV) - private var icon: BitmapDescriptorImpl? = options.icon?.remoteObject.unwrap() - private var alpha: Float = options.alpha - private var title: String? = options.title - private var snippet: String? = options.snippet - private var zIndex: Float = options.zIndex - private var draggable: Boolean = options.isDraggable - private var tag: IObjectWrapper? = null - - override var annotation: Symbol? = null - override var removed: Boolean = false - override val annotationOptions: SymbolOptions - get() { - val symbolOptions = SymbolOptions() - .withIconOpacity(if (visible) alpha else 0f) - .withIconRotate(rotation) - .withSymbolSortKey(zIndex) - .withDraggable(draggable) - - position.let { symbolOptions.withLatLng(it.toMapbox()) } - icon?.applyTo(symbolOptions, anchor, map.dpiFactor) - return symbolOptions - } - - override fun remove() { - removed = true - map.symbolManager?.let { update(it) } - } - - override fun update(manager: AnnotationManager<*, Symbol, SymbolOptions, *, *, *>) { - synchronized(this) { - val id = annotation?.id - if (removed && id != null) { - map.markers.remove(id) - } - super.update(manager) - val annotation = annotation - if (annotation != null && id == null) { - map.markers[annotation.id] = this - } - } - } - - override fun getId(): String = id - - override fun setPosition(position: LatLng?) { - this.position = position ?: return - annotation?.latLng = position.toMapbox() - map.symbolManager?.let { update(it) } - } - - override fun getPosition(): LatLng = position - - override fun setTitle(title: String?) { - this.title = title - } - - override fun getTitle(): String? = title - - override fun setSnippet(snippet: String?) { - this.snippet = snippet - } - - override fun getSnippet(): String? = snippet - - override fun setDraggable(draggable: Boolean) { - this.draggable = draggable - annotation?.isDraggable = draggable - map.symbolManager?.let { update(it) } - } - - override fun isDraggable(): Boolean = draggable - - override fun showInfoWindow() { - Log.d(TAG, "unimplemented Method: showInfoWindow") - } - - override fun hideInfoWindow() { - Log.d(TAG, "unimplemented Method: hideInfoWindow") - } - - override fun isInfoWindowShown(): Boolean { - Log.d(TAG, "unimplemented Method: isInfoWindowShow") - return false - } - - override fun setVisible(visible: Boolean) { - this.visible = visible - annotation?.iconOpacity = if (visible) alpha else 0f - map.symbolManager?.let { update(it) } - } - - override fun isVisible(): Boolean = visible - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other is IMarkerDelegate) return other.id == id - return false - } - - override fun equalsRemote(other: IMarkerDelegate?): Boolean = equals(other) - - override fun hashCode(): Int { - return id.hashCode() - } - - override fun toString(): String { - return "$id ($title)" - } - - override fun hashCodeRemote(): Int = hashCode() - - override fun setIcon(obj: IObjectWrapper?) { - obj.unwrap()?.let { icon -> - this.icon = icon - annotation?.let { icon.applyTo(it, anchor, map.dpiFactor) } - } - map.symbolManager?.let { update(it) } - } - - override fun setAnchor(x: Float, y: Float) { - anchor = floatArrayOf(x, y) - annotation?.let { icon?.applyTo(it, anchor, map.dpiFactor) } - map.symbolManager?.let { update(it) } - } - - override fun setFlat(flat: Boolean) { - Log.d(TAG, "unimplemented Method: setFlat") - } - - override fun isFlat(): Boolean { - Log.d(TAG, "unimplemented Method: isFlat") - return false - } - - override fun setRotation(rotation: Float) { - this.rotation = rotation - annotation?.iconRotate = rotation - map.symbolManager?.let { update(it) } - } - - override fun getRotation(): Float = rotation - - override fun setInfoWindowAnchor(x: Float, y: Float) { - Log.d(TAG, "unimplemented Method: setInfoWindowAnchor") - } - - override fun setAlpha(alpha: Float) { - this.alpha = alpha - annotation?.iconOpacity = if (visible) alpha else 0f - map.symbolManager?.let { update(it) } - } - - override fun getAlpha(): Float = alpha - - override fun setZIndex(zIndex: Float) { - this.zIndex = zIndex - annotation?.symbolSortKey = zIndex - map.symbolManager?.let { update(it) } - } - - override fun getZIndex(): Float = zIndex - - override fun setTag(obj: IObjectWrapper?) { - this.tag = obj - } - - override fun getTag(): IObjectWrapper? = tag - - companion object { - private val TAG = "GmsMapMarker" - } -} \ No newline at end of file diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Markup.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Markup.kt deleted file mode 100644 index c737afcc..00000000 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Markup.kt +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.mapbox.model - -import android.util.Log -import com.mapbox.mapboxsdk.plugins.annotation.Annotation -import com.mapbox.mapboxsdk.plugins.annotation.AnnotationManager -import com.mapbox.mapboxsdk.plugins.annotation.Options - -interface Markup, S : Options> { - var annotation: T? - val annotationOptions: S - val removed: Boolean - - fun update(manager: AnnotationManager<*, T, S, *, *, *>) { - synchronized(this) { - if (removed && annotation != null) { - manager.delete(annotation) - annotation = null - } else if (annotation != null) { - manager.update(annotation) - } else if (!removed) { - annotation = manager.create(annotationOptions) - } - } - } - - companion object { - private val TAG = "GmsMapMarkup" - } -} \ No newline at end of file diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Polygon.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Polygon.kt deleted file mode 100644 index e3d0d5ea..00000000 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Polygon.kt +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.mapbox.model - -import android.os.Parcel -import android.util.Log -import com.google.android.gms.maps.model.LatLng -import com.google.android.gms.maps.model.PolygonOptions -import com.google.android.gms.maps.model.PolylineOptions -import com.google.android.gms.maps.model.internal.IPolygonDelegate -import com.mapbox.mapboxsdk.plugins.annotation.AnnotationManager -import com.mapbox.mapboxsdk.plugins.annotation.Fill -import com.mapbox.mapboxsdk.plugins.annotation.FillOptions -import com.mapbox.mapboxsdk.utils.ColorUtils -import org.microg.gms.maps.mapbox.GoogleMapImpl -import org.microg.gms.maps.mapbox.utils.toMapbox - -class PolygonImpl(private val map: GoogleMapImpl, private val id: String, options: PolygonOptions) : IPolygonDelegate.Stub(), Markup { - private var points = ArrayList(options.points) - private var holes: List> = ArrayList(options.holes.map { ArrayList(it) }) - private var fillColor = options.fillColor - private var strokeColor = options.strokeColor - private var strokeWidth = options.strokeWidth - private var visible: Boolean = options.isVisible - - private var strokes = (listOf(PolylineImpl(map, "$id-stroke-main", PolylineOptions().color(strokeColor).width(strokeWidth).addAll(points))) - + holes.mapIndexed { idx, it -> PolylineImpl(map, "$id-stroke-hole-$idx", PolylineOptions().color(strokeColor).width(strokeWidth).addAll(it)) }).toMutableList() - - override var annotation: Fill? = null - override var removed: Boolean = false - override val annotationOptions: FillOptions - get() = FillOptions() - .withLatLngs(mutableListOf(points.map { it.toMapbox() }).plus(holes.map { it.map { it.toMapbox() } })) - .withFillColor(ColorUtils.colorToRgbaString(fillColor)) - .withFillOpacity(if (visible) 1f else 0f) - - override fun remove() { - removed = true - map.fillManager?.let { update(it) } - strokes.forEach { it.remove() } - } - - override fun update(manager: AnnotationManager<*, Fill, FillOptions, *, *, *>) { - super.update(manager) - map.lineManager?.let { lineManager -> strokes.forEach { it.update(lineManager) } } - } - - override fun getId(): String = id - - override fun setPoints(points: List) { - this.points = ArrayList(points) - annotation?.latLngs = mutableListOf(points.map { it.toMapbox() }).plus(holes.map { it.map { it.toMapbox() } }) - map.fillManager?.let { update(it) } - strokes[0].points = points - } - - override fun getPoints(): List = points - - override fun setHoles(holes: List?) { - this.holes = if (holes == null) emptyList() else ArrayList(holes.mapNotNull { if (it is List<*>) it.mapNotNull { if (it is LatLng) it else null }.let { if (it.isNotEmpty()) it else null } else null }) - annotation?.latLngs = mutableListOf(points.map { it.toMapbox() }).plus(this.holes.map { it.map { it.toMapbox() } }) - while (strokes.size > this.holes.size + 1) { - val last = strokes.last() - last.remove() - strokes.remove(last) - } - strokes.forEachIndexed { idx, it -> if (idx > 0) it.points = this.holes[idx - 1] } - if (this.holes.size + 1 > strokes.size) { - strokes.addAll(this.holes.subList(strokes.size, this.holes.size - 1).mapIndexed { idx, it -> PolylineImpl(map, "$id-stroke-hole-${strokes.size + idx}", PolylineOptions().color(strokeColor).width(strokeWidth).addAll(it)) }) - } - map.fillManager?.let { update(it) } - } - - override fun getHoles(): List = holes - - override fun setStrokeWidth(width: Float) { - this.strokeWidth = width - strokes.forEach { it.width = width } - } - - override fun getStrokeWidth(): Float = strokeWidth - - override fun setStrokeColor(color: Int) { - this.strokeColor = color - strokes.forEach { it.color = color } - } - - override fun getStrokeColor(): Int = strokeColor - - override fun setFillColor(color: Int) { - this.fillColor = color - annotation?.setFillColor(color) - map.fillManager?.let { update(it) } - } - - override fun getFillColor(): Int = fillColor - - override fun setZIndex(zIndex: Float) { - Log.d(TAG, "unimplemented Method: setZIndex") - } - - override fun getZIndex(): Float { - Log.d(TAG, "unimplemented Method: getZIndex") - return 0f - } - - override fun setVisible(visible: Boolean) { - this.visible = visible - annotation?.fillOpacity = if (visible) 1f else 0f - map.fillManager?.let { update(it) } - } - - override fun isVisible(): Boolean = visible - - override fun setGeodesic(geod: Boolean) { - Log.d(TAG, "unimplemented Method: setGeodesic") - } - - override fun isGeodesic(): Boolean { - Log.d(TAG, "unimplemented Method: isGeodesic") - return false - } - - override fun equalsRemote(other: IPolygonDelegate?): Boolean = equals(other) - - override fun hashCodeRemote(): Int = hashCode() - - override fun hashCode(): Int { - return id.hashCode() - } - - override fun toString(): String { - return id - } - - override fun equals(other: Any?): Boolean { - if (other is PolygonImpl) { - return other.id == id - } - return false - } - - override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean = - if (super.onTransact(code, data, reply, flags)) { - true - } else { - Log.d(TAG, "onTransact [unknown]: $code, $data, $flags"); false - } - - companion object { - private val TAG = "GmsMapPolygon" - } -} \ No newline at end of file diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Polyline.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Polyline.kt deleted file mode 100644 index f9a8f91b..00000000 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Polyline.kt +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.mapbox.model - -import android.os.Parcel -import android.util.Log -import com.google.android.gms.maps.model.LatLng -import com.google.android.gms.maps.model.internal.IPolylineDelegate -import com.mapbox.mapboxsdk.plugins.annotation.Line -import com.mapbox.mapboxsdk.plugins.annotation.LineOptions -import com.mapbox.mapboxsdk.utils.ColorUtils -import org.microg.gms.maps.mapbox.GoogleMapImpl -import org.microg.gms.maps.mapbox.utils.toMapbox -import com.google.android.gms.maps.model.PolylineOptions as GmsLineOptions - -class PolylineImpl(private val map: GoogleMapImpl, private val id: String, options: GmsLineOptions) : IPolylineDelegate.Stub(), Markup { - private var points = ArrayList(options.points) - private var width = options.width - private var color = options.color - private var visible: Boolean = options.isVisible - - override var annotation: Line? = null - override var removed: Boolean = false - override val annotationOptions: LineOptions - get() = LineOptions() - .withLatLngs(points.map { it.toMapbox() }) - .withLineWidth(width / map.dpiFactor) - .withLineColor(ColorUtils.colorToRgbaString(color)) - .withLineOpacity(if (visible) 1f else 0f) - - override fun remove() { - removed = true - map.lineManager?.let { update(it) } - } - - override fun getId(): String = id - - override fun setPoints(points: List) { - this.points = ArrayList(points) - annotation?.latLngs = points.map { it.toMapbox() } - map.lineManager?.let { update(it) } - } - - override fun getPoints(): List = points - - override fun setWidth(width: Float) { - this.width = width - annotation?.lineWidth = width / map.dpiFactor - map.lineManager?.let { update(it) } - } - - override fun getWidth(): Float = width - - override fun setColor(color: Int) { - this.color = color - annotation?.setLineColor(color) - map.lineManager?.let { update(it) } - } - - override fun getColor(): Int = color - - override fun setZIndex(zIndex: Float) { - Log.d(TAG, "unimplemented Method: setZIndex") - } - - override fun getZIndex(): Float { - Log.d(TAG, "unimplemented Method: getZIndex") - return 0f - } - - override fun setVisible(visible: Boolean) { - this.visible = visible - annotation?.lineOpacity = if (visible) 1f else 0f - map.lineManager?.let { update(it) } - } - - override fun isVisible(): Boolean = visible - - override fun setGeodesic(geod: Boolean) { - Log.d(TAG, "unimplemented Method: setGeodesic") - } - - override fun isGeodesic(): Boolean { - Log.d(TAG, "unimplemented Method: isGeodesic") - return false - } - - override fun equalsRemote(other: IPolylineDelegate?): Boolean = equals(other) - - override fun hashCodeRemote(): Int = hashCode() - - override fun hashCode(): Int { - return id.hashCode() - } - - override fun toString(): String { - return id - } - - override fun equals(other: Any?): Boolean { - if (other is PolylineImpl) { - return other.id == id - } - return false - } - - override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean = - if (super.onTransact(code, data, reply, flags)) { - true - } else { - Log.d(TAG, "onTransact [unknown]: $code, $data, $flags"); false - } - - companion object { - private val TAG = "GmsMapPolyline" - } -} \ No newline at end of file diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MapContext.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MapContext.kt deleted file mode 100644 index 2b00202a..00000000 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MapContext.kt +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.mapbox.utils - -import android.content.Context -import android.content.ContextWrapper -import android.content.Intent -import android.content.SharedPreferences -import android.view.LayoutInflater -import org.microg.gms.common.Constants -import java.io.File - -class MapContext(private val context: Context) : ContextWrapper(context.createPackageContext(Constants.GMS_PACKAGE_NAME, Context.CONTEXT_INCLUDE_CODE and Context.CONTEXT_IGNORE_SECURITY)) { - private var layoutInflater: LayoutInflater? = null - private val appContext: Context - get() = context.applicationContext ?: context - - override fun getApplicationContext(): Context { - return this - } - - override fun getCacheDir(): File { - val cacheDir = File(appContext.cacheDir, "com.google.android.gms") - cacheDir.mkdirs() - return cacheDir - } - - override fun getFilesDir(): File { - val filesDir = File(appContext.filesDir, "com.google.android.gms") - filesDir.mkdirs() - return filesDir - } - - override fun getPackageName(): String { - return appContext.packageName - } - - override fun getClassLoader(): ClassLoader { - return MapContext::class.java.classLoader!! - } - - override fun getSharedPreferences(name: String?, mode: Int): SharedPreferences { - return appContext.getSharedPreferences("com.google.android.gms_$name", mode) - } - - override fun getSystemService(name: String): Any? { - if (name == Context.LAYOUT_INFLATER_SERVICE) { - if (layoutInflater == null) { - layoutInflater = super.getSystemService(name) as LayoutInflater - layoutInflater?.cloneInContext(this)?.let { layoutInflater = it } - } - if (layoutInflater != null) { - return layoutInflater - } - } - return context.getSystemService(name) - } - - override fun startActivity(intent: Intent?) { - context.startActivity(intent) - } - - companion object { - val TAG = "GmsMapContext" - } -} \ No newline at end of file diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MultiArchLoader.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MultiArchLoader.kt deleted file mode 100644 index 598860f0..00000000 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MultiArchLoader.kt +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.mapbox.utils - -import android.annotation.SuppressLint -import android.content.Context -import android.content.pm.ApplicationInfo -import android.util.Log -import com.mapbox.mapboxsdk.LibraryLoader -import java.io.* -import java.util.zip.ZipFile - -class MultiArchLoader(private val mapContext: Context, private val appContext: Context) : LibraryLoader() { - @SuppressLint("UnsafeDynamicallyLoadedCode") - override fun load(name: String) { - try { - val otherAppInfo = mapContext.packageManager.getApplicationInfo(appContext.packageName, 0) - var primaryCpuAbi = ApplicationInfo::class.java.getField("primaryCpuAbi").get(otherAppInfo) as String? - if (primaryCpuAbi == "armeabi") { - primaryCpuAbi = "armeabi-v7a" - } - if (primaryCpuAbi != null) { - val path = "lib/$primaryCpuAbi/lib$name.so" - val cacheFile = File("${appContext.cacheDir.absolutePath}/.gmscore/$path") - cacheFile.parentFile.mkdirs() - val apkFile = File(mapContext.packageCodePath) - if (!cacheFile.exists() || cacheFile.lastModified() < apkFile.lastModified()) { - val zipFile = ZipFile(apkFile) - val entry = zipFile.getEntry(path) - if (entry != null) { - copyInputStream(zipFile.getInputStream(entry), FileOutputStream(cacheFile)) - } else { - Log.d(TAG, "Can't load native library: $path does not exist in $apkFile") - } - } - Log.d(TAG, "Loading $name from ${cacheFile.getPath()}") - System.load(cacheFile.absolutePath) - return - } - } catch (e: Exception) { - Log.w(TAG, e) - } - Log.d(TAG, "Loading native $name") - System.loadLibrary(name) - } - - @Throws(IOException::class) - private fun copyInputStream(inp: InputStream, out: OutputStream) { - val buffer = ByteArray(1024) - var len: Int = inp.read(buffer) - while (len >= 0) { - out.write(buffer, 0, len) - len = inp.read(buffer) - } - - inp.close() - out.close() - } - - companion object { - private val TAG = "GmsMultiArchLoader" - } - -} \ No newline at end of file diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/typeConverter.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/typeConverter.kt deleted file mode 100644 index d49cef35..00000000 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/typeConverter.kt +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.mapbox.utils - -import android.os.Bundle -import com.google.android.gms.maps.internal.ICancelableCallback -import com.mapbox.mapboxsdk.camera.CameraPosition -import com.mapbox.mapboxsdk.geometry.LatLng -import com.mapbox.mapboxsdk.geometry.LatLngBounds -import com.mapbox.mapboxsdk.geometry.VisibleRegion -import com.mapbox.mapboxsdk.maps.MapboxMap -import com.google.android.gms.maps.model.CameraPosition as GmsCameraPosition -import com.google.android.gms.maps.model.LatLng as GmsLatLng -import com.google.android.gms.maps.model.LatLngBounds as GmsLatLngBounds -import com.google.android.gms.maps.model.VisibleRegion as GmsVisibleRegion - -fun GmsLatLng.toMapbox(): LatLng = - LatLng(latitude, longitude) - -fun GmsLatLngBounds.toMapbox(): LatLngBounds = - LatLngBounds.from(this.northeast.latitude, this.northeast.longitude, this.southwest.latitude, this.southwest.longitude) - -fun GmsCameraPosition.toMapbox(): CameraPosition = - CameraPosition.Builder() - .target(target.toMapbox()) - .zoom(zoom.toDouble() - 1.0) - .tilt(tilt.toDouble()) - .bearing(bearing.toDouble()) - .build() - -fun ICancelableCallback.toMapbox(): MapboxMap.CancelableCallback = - object : MapboxMap.CancelableCallback { - override fun onFinish() = this@toMapbox.onFinish() - override fun onCancel() = this@toMapbox.onCancel() - } - - -fun Bundle.toMapbox(): Bundle { - val newBundle = Bundle(this) - for (key in newBundle.keySet()) { - val value = newBundle.get(key) - when (value) { - is GmsCameraPosition -> newBundle.putParcelable(key, value.toMapbox()) - is GmsLatLng -> newBundle.putParcelable(key, value.toMapbox()) - is GmsLatLngBounds -> newBundle.putParcelable(key, value.toMapbox()) - is Bundle -> newBundle.putBundle(key, value.toMapbox()) - } - } - return newBundle -} - -fun LatLng.toGms(): GmsLatLng = GmsLatLng(latitude, longitude) - -fun LatLngBounds.toGms(): GmsLatLngBounds = GmsLatLngBounds(southWest.toGms(), northEast.toGms()) - -fun CameraPosition.toGms(): GmsCameraPosition = - GmsCameraPosition(target.toGms(), zoom.toFloat() + 1.0f, tilt.toFloat(), bearing.toFloat()) - -fun Bundle.toGms(): Bundle { - val newBundle = Bundle(this) - for (key in newBundle.keySet()) { - val value = newBundle.get(key) - when (value) { - is CameraPosition -> newBundle.putParcelable(key, value.toGms()) - is LatLng -> newBundle.putParcelable(key, value.toGms()) - is LatLngBounds -> newBundle.putParcelable(key, value.toGms()) - is Bundle -> newBundle.putBundle(key, value.toGms()) - } - } - return newBundle -} - -fun VisibleRegion.toGms(): GmsVisibleRegion = - GmsVisibleRegion(nearLeft.toGms(), nearRight.toGms(), farLeft.toGms(), farRight.toGms(), latLngBounds.toGms()) \ No newline at end of file diff --git a/play-services-maps-core-mapbox/src/main/res/drawable-hdpi/maps_default_marker.png b/play-services-maps-core-mapbox/src/main/res/drawable-hdpi/maps_default_marker.png deleted file mode 100644 index 94c365a3..00000000 Binary files a/play-services-maps-core-mapbox/src/main/res/drawable-hdpi/maps_default_marker.png and /dev/null differ diff --git a/play-services-maps-core-mapbox/src/main/res/drawable-ldpi/maps_default_marker.png b/play-services-maps-core-mapbox/src/main/res/drawable-ldpi/maps_default_marker.png deleted file mode 100644 index a8ca2bf6..00000000 Binary files a/play-services-maps-core-mapbox/src/main/res/drawable-ldpi/maps_default_marker.png and /dev/null differ diff --git a/play-services-maps-core-mapbox/src/main/res/drawable-mdpi/maps_default_marker.png b/play-services-maps-core-mapbox/src/main/res/drawable-mdpi/maps_default_marker.png deleted file mode 100644 index c79736e7..00000000 Binary files a/play-services-maps-core-mapbox/src/main/res/drawable-mdpi/maps_default_marker.png and /dev/null differ diff --git a/play-services-maps-core-mapbox/src/main/res/drawable-xhdpi/maps_default_marker.png b/play-services-maps-core-mapbox/src/main/res/drawable-xhdpi/maps_default_marker.png deleted file mode 100644 index 0b1b1975..00000000 Binary files a/play-services-maps-core-mapbox/src/main/res/drawable-xhdpi/maps_default_marker.png and /dev/null differ diff --git a/play-services-maps-core-mapbox/src/main/res/drawable-xxhdpi/maps_default_marker.png b/play-services-maps-core-mapbox/src/main/res/drawable-xxhdpi/maps_default_marker.png deleted file mode 100644 index 709bf78d..00000000 Binary files a/play-services-maps-core-mapbox/src/main/res/drawable-xxhdpi/maps_default_marker.png and /dev/null differ diff --git a/play-services-maps-core-mapbox/src/main/res/drawable-xxxhdpi/maps_default_marker.png b/play-services-maps-core-mapbox/src/main/res/drawable-xxxhdpi/maps_default_marker.png deleted file mode 100644 index 0de5d255..00000000 Binary files a/play-services-maps-core-mapbox/src/main/res/drawable-xxxhdpi/maps_default_marker.png and /dev/null differ diff --git a/play-services-maps-core-vtm/build.gradle b/play-services-maps-core-vtm/build.gradle deleted file mode 100644 index 1a00c16e..00000000 --- a/play-services-maps-core-vtm/build.gradle +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2013-2019 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. - */ - -apply plugin: "com.android.library" - -dependencies { - implementation project(":play-services-api") - - implementation "org.microg:vtm-android:0.9.1-mod" - implementation "org.microg:vtm-android:0.9.1-mod:natives-armeabi" - implementation "org.microg:vtm-android:0.9.1-mod:natives-armeabi-v7a" - implementation "org.microg:vtm-android:0.9.1-mod:natives-arm64-v8a" - implementation "org.microg:vtm-android:0.9.1-mod:natives-x86" - implementation "org.microg:vtm-android:0.9.1-mod:natives-x86_64" - implementation "org.microg:vtm-extras:0.9.1-mod" - implementation "org.microg:vtm-jts:0.9.1-mod" - implementation project(":play-services-maps-core-vtm:vtm-microg-theme") - - implementation "androidx.appcompat:appcompat:$appcompatVersion" -} - -def execResult(...args) { - def stdout = new ByteArrayOutputStream() - exec { - commandLine args - standardOutput = stdout - } - return stdout.toString().trim() -} - -android { - compileSdkVersion androidCompileSdk() - buildToolsVersion "$androidBuildVersionTools" - - defaultConfig { - versionName "temp" - versionCode 1 - - minSdkVersion androidMinSdk() - targetSdkVersion androidTargetSdk() - - ndk { - abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86", "x86_64" - } - } - - lintOptions { - disable "MissingTranslation", "InvalidPackage", "BatteryLife", "ImpliedQuantity", "MissingQuantity" - } - - buildTypes { - release { - minifyEnabled true - proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } -} - -if (file("user.gradle").exists()) { - apply from: "user.gradle" -} diff --git a/play-services-maps-core-vtm/src/main/AndroidManifest.xml b/play-services-maps-core-vtm/src/main/AndroidManifest.xml deleted file mode 100644 index 31b554e4..00000000 --- a/play-services-maps-core-vtm/src/main/AndroidManifest.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/play-services-maps-core-vtm/src/main/java/com/google/android/gms/maps/internal/CreatorImpl.java b/play-services-maps-core-vtm/src/main/java/com/google/android/gms/maps/internal/CreatorImpl.java deleted file mode 100644 index 42e83ec3..00000000 --- a/play-services-maps-core-vtm/src/main/java/com/google/android/gms/maps/internal/CreatorImpl.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.internal; - -import android.app.Activity; -import android.content.Context; -import android.content.res.Resources; -import android.os.Parcel; -import android.os.RemoteException; -import android.util.Log; - -import androidx.annotation.Keep; - -import com.google.android.gms.dynamic.IObjectWrapper; -import com.google.android.gms.dynamic.ObjectWrapper; -import com.google.android.gms.maps.GoogleMapOptions; -import com.google.android.gms.maps.model.internal.IBitmapDescriptorFactoryDelegate; - -import org.microg.gms.maps.vtm.MapFragmentImpl; -import org.microg.gms.maps.vtm.MapViewImpl; -import org.microg.gms.maps.vtm.ResourcesContainer; -import org.microg.gms.maps.vtm.bitmap.BitmapDescriptorFactoryImpl; -import org.microg.gms.maps.vtm.camera.CameraUpdateFactoryImpl; - -@Keep -public class CreatorImpl extends ICreator.Stub { - private static final String TAG = "GmsMapCreator"; - - @Override - public void init(IObjectWrapper resources) throws RemoteException { - initV2(resources, 0); - } - - @Override - public IMapFragmentDelegate newMapFragmentDelegate(IObjectWrapper activity) throws RemoteException { - return new MapFragmentImpl((Activity) ObjectWrapper.unwrap(activity)); - } - - @Override - public IMapViewDelegate newMapViewDelegate(IObjectWrapper context, GoogleMapOptions options) throws RemoteException { - return new MapViewImpl((Context) ObjectWrapper.unwrap(context), options); - } - - @Override - public ICameraUpdateFactoryDelegate newCameraUpdateFactoryDelegate() throws RemoteException { - return CameraUpdateFactoryImpl.get(); - } - - @Override - public IBitmapDescriptorFactoryDelegate newBitmapDescriptorFactoryDelegate() throws RemoteException { - return new BitmapDescriptorFactoryImpl(); - } - - @Override - public void initV2(IObjectWrapper resources, int flags) throws RemoteException { - ResourcesContainer.set((Resources) ObjectWrapper.unwrap(resources)); - } - - @Override - public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { - if (super.onTransact(code, data, reply, flags)) return true; - Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags); - return false; - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ApplicationContextWrapper.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ApplicationContextWrapper.java deleted file mode 100644 index ebb6caa6..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ApplicationContextWrapper.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.vtm; - -import android.content.Context; -import android.content.ContextWrapper; -import android.content.pm.PackageManager; - -import org.microg.gms.common.Constants; - -public class ApplicationContextWrapper extends ContextWrapper { - private Context applicationContext; - - public ApplicationContextWrapper(Context base, Context applicationContext) { - super(base); - this.applicationContext = applicationContext; - } - - public static ApplicationContextWrapper gmsContextWithAttachedApplicationContext(Context applicationContext) { - try { - Context context = applicationContext.createPackageContext(Constants.GMS_PACKAGE_NAME, CONTEXT_INCLUDE_CODE & CONTEXT_IGNORE_SECURITY); - return new ApplicationContextWrapper(context, applicationContext); - } catch (PackageManager.NameNotFoundException e) { - throw new RuntimeException(e); - } - } - - public static ApplicationContextWrapper matchingApplicationContext(Context context) { - return new ApplicationContextWrapper(context, context); - } - - @Override - public Context getApplicationContext() { - return applicationContext; - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/BackendMap.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/BackendMap.java deleted file mode 100644 index 2a94e5fb..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/BackendMap.java +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.vtm; - -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.graphics.Paint; -import android.os.RemoteException; -import android.util.Log; -import android.view.View; - -import com.google.android.gms.maps.internal.ISnapshotReadyCallback; -import com.google.android.gms.maps.model.CameraPosition; - -import org.microg.gms.maps.vtm.camera.CameraUpdate; -import org.microg.gms.maps.vtm.markup.DrawableMarkup; -import org.microg.gms.maps.vtm.markup.MarkerItemMarkup; -import org.microg.gms.maps.vtm.markup.Markup; -import org.oscim.backend.GL; -import org.oscim.backend.GLAdapter; -import org.oscim.core.MapPosition; -import org.oscim.core.Point; -import org.oscim.event.Event; -import org.oscim.event.MotionEvent; -import org.oscim.layers.marker.ItemizedLayer; -import org.oscim.layers.marker.MarkerItem; -import org.oscim.layers.vector.geometries.Drawable; -import org.oscim.map.Viewport; - -import java.nio.IntBuffer; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.microedition.khronos.opengles.GL10; - -public class BackendMap implements ItemizedLayer.OnItemGestureListener, org.oscim.map.Map.InputListener, org.oscim.map.Map.UpdateListener { - private final static String TAG = "GmsMapBackend"; - - private final Context context; - private final BackendMapView mapView; - private final ContainerLayout container; - private final CameraUpdateListener cameraUpdateListener; - private final Map markupMap = new HashMap(); - private final List drawableMarkups = new ArrayList(); - private MarkerItemMarkup currentlyDraggedItem; - private float dragLastX = -1; - private float dragLastY = -1; - - public BackendMap(Context context, final CameraUpdateListener cameraUpdateListener) { - this.context = context; - this.cameraUpdateListener = cameraUpdateListener; - mapView = new BackendMapView(context); - mapView.items().setOnItemGestureListener(this); - mapView.map().input.bind(this); - mapView.map().events.bind(this); - container = new ContainerLayout(context); - container.addView(mapView); - } - - public Viewport getViewport() { - return mapView.map().viewport(); - } - - public void destroy() { - mapView.map().destroy(); - } - - public void onResume() { - mapView.onResume(); - } - - public void onPause() { - mapView.onPause(); - } - - public MapPosition getMapPosition() { - return mapView.map().getMapPosition(); - } - - public View getView() { - return container; - } - - public boolean hasBuilding() { - return mapView.map().layers().contains(mapView.buildings()); - } - - public void setBuildings(boolean buildingsEnabled) { - if (!hasBuilding() && buildingsEnabled) { - mapView.map().layers().add(mapView.buildings()); - } else if (hasBuilding() && !buildingsEnabled) { - mapView.map().layers().remove(mapView.buildings()); - } - redraw(); - } - - public void redraw() { - mapView.map().updateMap(true); - } - - public void applyCameraUpdate(CameraUpdate cameraUpdate) { - cameraUpdate.apply(mapView.map()); - } - - public void applyCameraUpdateAnimated(CameraUpdate cameraUpdate, int durationMs) { - cameraUpdate.applyAnimated(mapView.map(), durationMs); - } - - public void stopAnimation() { - mapView.map().animator().cancel(); - } - - public synchronized T add(T markup) { - if (markup == null) return null; - drawableMarkups.add(markup); - Collections.sort(drawableMarkups, new Comparator() { - @Override - public int compare(DrawableMarkup lhs, DrawableMarkup rhs) { - return Float.compare(lhs.getZIndex(), rhs.getZIndex()); - } - }); - updateDrawableLayer(); - redraw(); - return markup; - } - - private synchronized void updateDrawableLayer() { - mapView.drawables().clear(); - for (DrawableMarkup markup : drawableMarkups) { - Drawable drawable = markup.getDrawable(mapView.map()); - if (drawable != null) { - mapView.drawables().add(drawable); - } - } - } - - public synchronized T add(T markup) { - if (markup == null) return null; - markupMap.put(markup.getId(), markup); - MarkerItem item = markup.getMarkerItem(context); - mapView.items().addItem(item); - redraw(); - return markup; - } - - public synchronized void clear() { - markupMap.clear(); - mapView.items().removeAllItems(); - drawableMarkups.clear(); - mapView.drawables().clear(); - redraw(); - } - - public synchronized void remove(Markup markup) { - if (markup instanceof MarkerItemMarkup) { - markupMap.remove(markup.getId()); - MarkerItem toRemove = getByUid(markup.getId()); - if (toRemove != null) mapView.items().removeItem(toRemove); - } else if (markup instanceof DrawableMarkup) { - drawableMarkups.remove(markup); - updateDrawableLayer(); - mapView.drawables().update(); - } - redraw(); - } - - private MarkerItem getByUid(String uid) { - for (MarkerItem markerItem : mapView.items().getItemList()) { - if (markerItem.getUid().equals(uid)) { - return markerItem; - } - } - return null; - } - - public synchronized void update(Markup markup) { - if (markup == null) return; - if (markup instanceof MarkerItemMarkup) { - MarkerItem item = getByUid(markup.getId()); - if (item != null) { - mapView.items().removeItem(item); - } - item = ((MarkerItemMarkup) markup).getMarkerItem(context); - if (item != null) { - mapView.items().addItem(item); - } - } else if (markup instanceof DrawableMarkup) { - updateDrawableLayer(); - mapView.drawables().update(); - } - redraw(); - } - - @Override - public boolean onItemSingleTapUp(int index, MarkerItem item) { - Markup markup = markupMap.get(item.getUid()); - if (markup != null) { - if (markup.onClick()) return true; - } - return false; - } - - @Override - public boolean onItemLongPress(int index, MarkerItem item) { - Markup markup = markupMap.get(item.getUid()); - if (((MarkerItemMarkup) markup).isDraggable()) { - currentlyDraggedItem = (MarkerItemMarkup) markup; - currentlyDraggedItem.onDragStart(); - return false; - } else { - Log.d(TAG, "onItemLongPress: " + markup); - return false; - } - } - - @Override - public void onInputEvent(Event event, MotionEvent motionEvent) { - if ((motionEvent.getAction() == MotionEvent.ACTION_CANCEL || motionEvent.getAction() == MotionEvent.ACTION_UP) && currentlyDraggedItem != null) { - currentlyDraggedItem.onDragStop(); - currentlyDraggedItem = null; - } - if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) { - dragLastX = motionEvent.getX(); - dragLastY = motionEvent.getY(); - } - if (motionEvent.getAction() == MotionEvent.ACTION_MOVE && currentlyDraggedItem != null) { - Point out = new Point(); - mapView.map().viewport().toScreenPoint(GmsMapsTypeHelper.fromLatLng(currentlyDraggedItem.getPosition()), out); - out.x += mapView.getWidth() / 2; - out.y += mapView.getHeight() / 2; - float mx = motionEvent.getX() - dragLastX; - float my = motionEvent.getY() - dragLastY; - currentlyDraggedItem.setPosition(GmsMapsTypeHelper.toLatLng(mapView.map().viewport().fromScreenPoint((float) out.getX() + mx, (float) out.getY() + my))); - currentlyDraggedItem.onDragProgress(); - dragLastX += mx; - dragLastY += my; - } - } - - public void snapshot(final Bitmap bitmap, final ISnapshotReadyCallback callback) { - mapView.queueEvent(new Runnable() { - @Override - public void run() { - Bitmap surface = createBitmapFromGLSurface(0, 0, mapView.getWidth(), mapView.getHeight(), GLAdapter.gl); - final Bitmap result; - if (bitmap != null) { - Canvas c = new Canvas(bitmap); - c.drawBitmap(surface, 0, 0, new Paint()); - result = bitmap; - } else { - result = surface; - } - mapView.getHandler().post(new Runnable() { - @Override - public void run() { - Log.d(TAG, "snapshot result: " + result); - try { - callback.onBitmapReady(result); - } catch (RemoteException e) { - Log.w(TAG, e); - } - } - }); - } - }); - } - - private Bitmap createBitmapFromGLSurface(int x, int y, int w, int h, GL gl) { - int bitmapBuffer[] = new int[w * h]; - int bitmapSource[] = new int[w * h]; - IntBuffer intBuffer = IntBuffer.wrap(bitmapBuffer); - intBuffer.position(0); - - try { - gl.readPixels(x, y, w, h, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, intBuffer); - int offset1, offset2; - for (int i = 0; i < h; i++) { - offset1 = i * w; - offset2 = (h - i - 1) * w; - for (int j = 0; j < w; j++) { - int texturePixel = bitmapBuffer[offset1 + j]; - int blue = (texturePixel >> 16) & 0xff; - int red = (texturePixel << 16) & 0x00ff0000; - int pixel = (texturePixel & 0xff00ff00) | red | blue; - bitmapSource[offset2 + j] = pixel; - } - } - } catch (Exception e) { - Log.e(TAG, "createBitmapFromGLSurface: " + e.getMessage(), e); - return null; - } - - return Bitmap.createBitmap(bitmapSource, w, h, Bitmap.Config.ARGB_8888); - } - - public void setZoomGesturesEnabled(boolean enabled) { - mapView.map().getEventLayer().enableZoom(enabled); - } - - public void setScrollGesturesEnabled(boolean enabled) { - mapView.map().getEventLayer().enableMove(enabled); - } - - public void setRotateGesturesEnabled(boolean enabled) { - mapView.map().getEventLayer().enableRotation(enabled); - } - - public void setTiltGesturesEnabled(boolean enabled) { - mapView.map().getEventLayer().enableTilt(enabled); - } - - @Override - public void onMapEvent(Event event, MapPosition mapPosition) { - if (event == org.oscim.map.Map.ANIM_END || event == org.oscim.map.Map.POSITION_EVENT || event == org.oscim.map.Map.MOVE_EVENT) - cameraUpdateListener.onCameraUpdate(GmsMapsTypeHelper.toCameraPosition(mapPosition)); - } - - public interface CameraUpdateListener { - void onCameraUpdate(CameraPosition cameraPosition); - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/BackendMapView.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/BackendMapView.java deleted file mode 100644 index 6af341e6..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/BackendMapView.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.vtm; - -import android.content.Context; -import android.content.ContextWrapper; -import android.content.pm.ApplicationInfo; -import android.graphics.BitmapFactory; -import android.util.AttributeSet; -import android.util.Log; - -import org.microg.gms.maps.vtm.data.SharedTileCache; -import org.microg.gms.maps.vtm.markup.ClearableVectorLayer; -import org.microg.gms.maps.vtm.R; -import org.oscim.android.AndroidAssets; -import org.oscim.android.MapView; -import org.oscim.android.canvas.AndroidBitmap; -import org.oscim.layers.marker.ItemizedLayer; -import org.oscim.layers.marker.MarkerItem; -import org.oscim.layers.marker.MarkerSymbol; -import org.oscim.layers.tile.buildings.BuildingLayer; -import org.oscim.layers.tile.vector.VectorTileLayer; -import org.oscim.layers.tile.vector.labeling.LabelLayer; -import org.oscim.map.Layers; -import org.oscim.theme.MicrogThemes; -import org.oscim.tiling.ITileCache; -import org.oscim.tiling.source.oscimap4.OSciMap4TileSource; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Enumeration; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -public class BackendMapView extends MapView { - private static final String TAG = "GmsMapView"; - - private static boolean nativeLibLoaded = false; - private LabelLayer labels; - private BuildingLayer buildings; - private ItemizedLayer items; - private ClearableVectorLayer drawables; - - static synchronized Context loadNativeLib(Context context) { - try { - if (nativeLibLoaded) return context; - ApplicationInfo otherAppInfo = context.getPackageManager().getApplicationInfo(context.getApplicationContext().getPackageName(), 0); - - String primaryCpuAbi = (String) ApplicationInfo.class.getField("primaryCpuAbi").get(otherAppInfo); - if (primaryCpuAbi != null) { - String path = "lib/" + primaryCpuAbi + "/libvtm-jni.so"; - File cacheFile = new File(context.getApplicationContext().getCacheDir().getAbsolutePath() + "/.gmscore/" + path); - cacheFile.getParentFile().mkdirs(); - File apkFile = new File(context.getPackageCodePath()); - if (!cacheFile.exists() || cacheFile.lastModified() < apkFile.lastModified()) { - ZipFile zipFile = new ZipFile(apkFile); - ZipEntry entry = zipFile.getEntry(path); - if (entry != null) { - copyInputStream(zipFile.getInputStream(entry), new FileOutputStream(cacheFile)); - } else { - Log.d(TAG, "Can't load native library: " + path + " does not exist in " + apkFile); - } - } - Log.d(TAG, "Loading vtm-jni from " + cacheFile.getPath()); - System.load(cacheFile.getAbsolutePath()); - nativeLibLoaded = true; - } - } catch (Exception e) { - Log.w(TAG, e); - } - if (!nativeLibLoaded) { - Log.d(TAG, "Loading native vtm-jni"); - System.loadLibrary("vtm-jni"); - nativeLibLoaded = true; - } - return context; - } - - private static final void copyInputStream(InputStream in, OutputStream out) throws IOException { - byte[] buffer = new byte[1024]; - int len; - - while ((len = in.read(buffer)) >= 0) - out.write(buffer, 0, len); - - in.close(); - out.close(); - } - - @Override - public void onResume() { - super.onResume(); - } - - @Override - public void onPause() { - super.onPause(); - } - - public BackendMapView(Context context) { - super(loadNativeLib(context)); - if (context instanceof ContextWrapper) { - AndroidAssets.init(ApplicationContextWrapper.matchingApplicationContext(((ContextWrapper) context).getBaseContext())); - } - initialize(); - } - - public BackendMapView(Context context, AttributeSet attributeSet) { - super(loadNativeLib(context), attributeSet); - initialize(); - } - - ItemizedLayer items() { - return items; - } - - BuildingLayer buildings() { - return buildings; - } - - ClearableVectorLayer drawables() { - return drawables; - } - - private void initialize() { - ITileCache cache = new SharedTileCache(getContext()); - cache.setCacheSize(512 * (1 << 10)); - OSciMap4TileSource tileSource = new OSciMap4TileSource(); - tileSource.setCache(cache); - VectorTileLayer baseLayer = map().setBaseMap(tileSource); - Layers layers = map().layers(); - layers.add(drawables = new ClearableVectorLayer(map())); - layers.add(labels = new LabelLayer(map(), baseLayer)); - layers.add(buildings = new BuildingLayer(map(), baseLayer)); - layers.add(items = new ItemizedLayer(map(), new MarkerSymbol( - new AndroidBitmap(BitmapFactory.decodeResource(getContext().getResources(), R.drawable.nop)), 0.5F, 1))); - map().setTheme(MicrogThemes.DEFAULT); - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ContainerLayout.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ContainerLayout.java deleted file mode 100644 index 468d38b4..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ContainerLayout.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.vtm; - -import android.content.Context; -import android.widget.FrameLayout; - -import org.oscim.utils.ThreadUtils; - -public class ContainerLayout extends FrameLayout { - public ContainerLayout(Context context) { - super(context); - } - - @Override - protected void onLayout(boolean changed, int left, int top, int right, int bottom) { - ThreadUtils.init(); - super.onLayout(changed, left, top, right, bottom); - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/GmsMapsTypeHelper.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/GmsMapsTypeHelper.java deleted file mode 100644 index c68b9460..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/GmsMapsTypeHelper.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.vtm; - -import com.google.android.gms.maps.model.CameraPosition; -import com.google.android.gms.maps.model.LatLng; -import com.google.android.gms.maps.model.LatLngBounds; - -import org.oscim.core.BoundingBox; -import org.oscim.core.Box; -import org.oscim.core.GeoPoint; -import org.oscim.core.MapPosition; -import org.oscim.core.MercatorProjection; - -public class GmsMapsTypeHelper { - public static android.graphics.Point toPoint(org.oscim.core.Point in) { - return new android.graphics.Point((int) in.getX(), (int) in.getY()); - } - - public static GeoPoint fromLatLng(LatLng latLng) { - return new GeoPoint(latLng.latitude, latLng.longitude); - } - - public static LatLng toLatLng(GeoPoint geoPoint) { - return new LatLng(geoPoint.getLatitude(), geoPoint.getLongitude()); - } - - public static LatLngBounds toLatLngBounds(Box box) { - double minLon = MercatorProjection.toLongitude(box.xmin); - double maxLon = MercatorProjection.toLongitude(box.xmax); - double minLat = MercatorProjection.toLatitude(box.ymax); - double maxLat = MercatorProjection.toLatitude(box.ymin); - if (Double.isNaN(minLon) || Double.isNaN(maxLon) || Double.isNaN(minLat) || Double.isNaN(maxLat)) - minLon = maxLon = minLat = maxLat = 0; - return new LatLngBounds(new LatLng(minLat, minLon), new LatLng(maxLat, maxLon)); - } - - public static org.oscim.core.Point fromPoint(android.graphics.Point point) { - return new org.oscim.core.Point(point.x, point.y); - } - - public static CameraPosition toCameraPosition(MapPosition mapPosition) { - return new CameraPosition(new LatLng(mapPosition.getLatitude(), mapPosition.getLongitude()), - toZoom(mapPosition.getScale()), mapPosition.getTilt(), - toBearing(mapPosition.getBearing())); - } - - public static MapPosition fromCameraPosition(CameraPosition cameraPosition) { - MapPosition mapPosition = new MapPosition(cameraPosition.target.latitude, - cameraPosition.target.longitude, fromZoom(cameraPosition.zoom)); - mapPosition.setTilt(cameraPosition.tilt); - mapPosition.setBearing(fromBearing(cameraPosition.bearing)); - return mapPosition; - } - - public static BoundingBox fromLatLngBounds(LatLngBounds bounds) { - return new BoundingBox(bounds.southwest.latitude, bounds.southwest.longitude, - bounds.northeast.latitude, bounds.northeast.longitude); - } - - public static float fromBearing(float bearing) { - return -bearing; - } - - public static float toBearing(float bearing) { - return -bearing; - } - - public static double fromZoom(float zoom) { - return Math.pow(2, zoom); - } - - public static float toZoom(double scale) { - return (float) (Math.log(scale) / Math.log(2)); - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/GoogleMapImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/GoogleMapImpl.java deleted file mode 100644 index f34c066e..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/GoogleMapImpl.java +++ /dev/null @@ -1,707 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.vtm; - -import android.content.Context; -import android.graphics.Bitmap; -import android.location.Criteria; -import android.location.Location; -import android.location.LocationListener; -import android.location.LocationManager; -import android.os.Bundle; -import android.os.Handler; -import android.os.Looper; -import android.os.Parcel; -import android.os.RemoteException; -import android.util.Log; -import android.view.View; - -import androidx.core.content.ContextCompat; - -import com.google.android.gms.dynamic.IObjectWrapper; -import com.google.android.gms.dynamic.ObjectWrapper; -import com.google.android.gms.maps.GoogleMapOptions; -import com.google.android.gms.maps.internal.ICancelableCallback; -import com.google.android.gms.maps.internal.IGoogleMapDelegate; -import com.google.android.gms.maps.internal.IInfoWindowAdapter; -import com.google.android.gms.maps.internal.ILocationSourceDelegate; -import com.google.android.gms.maps.internal.IOnCameraChangeListener; -import com.google.android.gms.maps.internal.IOnCameraIdleListener; -import com.google.android.gms.maps.internal.IOnCameraMoveCanceledListener; -import com.google.android.gms.maps.internal.IOnCameraMoveListener; -import com.google.android.gms.maps.internal.IOnCameraMoveStartedListener; -import com.google.android.gms.maps.internal.IOnInfoWindowClickListener; -import com.google.android.gms.maps.internal.IOnMapClickListener; -import com.google.android.gms.maps.internal.IOnMapLoadedCallback; -import com.google.android.gms.maps.internal.IOnMapLongClickListener; -import com.google.android.gms.maps.internal.IOnMarkerClickListener; -import com.google.android.gms.maps.internal.IOnMarkerDragListener; -import com.google.android.gms.maps.internal.IOnMyLocationButtonClickListener; -import com.google.android.gms.maps.internal.IOnMyLocationChangeListener; -import com.google.android.gms.maps.internal.IProjectionDelegate; -import com.google.android.gms.maps.internal.ISnapshotReadyCallback; -import com.google.android.gms.maps.internal.IUiSettingsDelegate; -import com.google.android.gms.maps.model.CameraPosition; -import com.google.android.gms.maps.model.CircleOptions; -import com.google.android.gms.maps.model.GroundOverlayOptions; -import com.google.android.gms.maps.model.LatLngBounds; -import com.google.android.gms.maps.model.MarkerOptions; -import com.google.android.gms.maps.model.PolygonOptions; -import com.google.android.gms.maps.model.PolylineOptions; -import com.google.android.gms.maps.model.TileOverlayOptions; -import com.google.android.gms.maps.model.internal.ICircleDelegate; -import com.google.android.gms.maps.model.internal.IGroundOverlayDelegate; -import com.google.android.gms.maps.model.internal.IMarkerDelegate; -import com.google.android.gms.maps.model.internal.IPolygonDelegate; -import com.google.android.gms.maps.model.internal.IPolylineDelegate; -import com.google.android.gms.maps.model.internal.ITileOverlayDelegate; - -import org.microg.gms.maps.vtm.camera.CameraUpdate; -import org.microg.gms.maps.vtm.camera.MapPositionCameraUpdate; -import org.microg.gms.maps.vtm.markup.CircleImpl; -import org.microg.gms.maps.vtm.markup.GroundOverlayImpl; -import org.microg.gms.maps.vtm.markup.MarkerImpl; -import org.microg.gms.maps.vtm.markup.Markup; -import org.microg.gms.maps.vtm.markup.PolygonImpl; -import org.microg.gms.maps.vtm.markup.PolylineImpl; -import org.microg.gms.maps.vtm.markup.TileOverlayImpl; - -import static android.Manifest.permission.ACCESS_COARSE_LOCATION; -import static android.Manifest.permission.ACCESS_FINE_LOCATION; -import static android.content.pm.PackageManager.PERMISSION_GRANTED; - -public class GoogleMapImpl extends IGoogleMapDelegate.Stub - implements UiSettingsImpl.UiSettingsListener, Markup.MarkupListener, BackendMap.CameraUpdateListener { - private static final String TAG = "GmsMapImpl"; - - private final GoogleMapOptions options; - private final Context context; - private final BackendMap backendMap; - private final UiSettingsImpl uiSettings; - private final ProjectionImpl projection; - - private int markerCounter = 0; - private int circleCounter = 0; - private int polylineCounter = 0; - private int polygonCounter = 0; - - private IOnMarkerClickListener onMarkerClickListener; - private IOnMarkerDragListener onMarkerDragListener; - private IOnCameraChangeListener onCameraChangeListener; - private IOnMyLocationChangeListener onMyLocationChangeListener; - - private Criteria criteria; - private Location myLocation; - private LocationListener listener = new LocationListener() { - @Override - public void onLocationChanged(Location location) { - // TODO: Actually do my location overlay - myLocation = location; - if (onMyLocationChangeListener != null && location != null) { - try { - onMyLocationChangeListener.onMyLocationChanged(ObjectWrapper.wrap(location)); - } catch (RemoteException e) { - e.printStackTrace(); - } - } - } - - @Override - public void onStatusChanged(String provider, int status, Bundle extras) { - } - - @Override - public void onProviderEnabled(String provider) { - } - - @Override - public void onProviderDisabled(String provider) { - } - }; - - private GoogleMapImpl(Context context, GoogleMapOptions options) { - this.context = context; - Context appContext = context; - if (appContext.getApplicationContext() != null) - appContext = appContext.getApplicationContext(); - Context wrappedContext = ApplicationContextWrapper.gmsContextWithAttachedApplicationContext(appContext); - backendMap = new BackendMap(wrappedContext, this); - uiSettings = new UiSettingsImpl(this); - projection = new ProjectionImpl(backendMap.getViewport()); - this.options = options; - - criteria = new Criteria(); - criteria.setAccuracy(Criteria.ACCURACY_COARSE); - criteria.setPowerRequirement(Criteria.POWER_MEDIUM); - - if (options != null) initFromOptions(); - } - - public synchronized static GoogleMapImpl create(Context context, GoogleMapOptions options) { - return new GoogleMapImpl(context, options); - } - - private void initFromOptions() { - try { - uiSettings.setCompassEnabled(options.getCompassEnabled()); - uiSettings.setRotateGesturesEnabled(options.isRotateGesturesEnabled()); - uiSettings.setTiltGesturesEnabled(options.isTiltGesturesEnabled()); - uiSettings.setScrollGesturesEnabled(options.isScrollGesturesEnabled()); - uiSettings.setZoomControlsEnabled(options.isZoomControlsEnabled()); - uiSettings.setZoomGesturesEnabled(options.isZoomGesturesEnabled()); - if (options.getCamera() != null) { - backendMap.applyCameraUpdate(MapPositionCameraUpdate.directMapPosition(GmsMapsTypeHelper.fromCameraPosition(options.getCamera()))); - } - } catch (RemoteException e) { - // Never happens: not remote - } - } - - public void onDestroy() { - backendMap.destroy(); - } - - @Override - public void onLowMemory() throws RemoteException { - Log.d(TAG, "unimplemented Method: onLowMemory"); - - } - - @Override - public boolean useViewLifecycleWhenInFragment() throws RemoteException { - Log.d(TAG, "unimplemented Method: useViewLifecycleWhenInFragment"); - return false; - } - - @Override - public void onSaveInstanceState(Bundle outState) throws RemoteException { - Log.d(TAG, "unimplemented Method: onSaveInstanceState"); - - } - - @Override - public void setContentDescription(String desc) throws RemoteException { - Log.d(TAG, "unimplemented Method: setContentDescription"); - - } - - @Override - public void onEnterAmbient(Bundle bundle) throws RemoteException { - Log.d(TAG, "unimplemented Method: onEnterAmbient"); - - } - - @Override - public void onExitAmbient() throws RemoteException { - Log.d(TAG, "unimplemented Method: onExitAmbient"); - - } - - @Override - public void setMinZoomPreference(float minZoom) throws RemoteException { - Log.d(TAG, "unimplemented Method: setMinZoomPreference"); - - } - - @Override - public void setMaxZoomPreference(float maxZoom) throws RemoteException { - Log.d(TAG, "unimplemented Method: setMaxZoomPreference"); - - } - - @Override - public void resetMinMaxZoomPreference() throws RemoteException { - Log.d(TAG, "unimplemented Method: resetMinMaxZoomPreference"); - - } - - @Override - public void setLatLngBoundsForCameraTarget(LatLngBounds bounds) throws RemoteException { - Log.d(TAG, "unimplemented Method: setLatLngBoundsForCameraTarget"); - - } - - public void onResume() { - backendMap.onResume(); - } - - public void onPause() { - backendMap.onPause(); - } - - public View getView() { - return backendMap.getView(); - } - - private String getNextMarkerId() { - return "m" + markerCounter++; - } - - private String getNextCircleId() { - return "c" + circleCounter++; - } - - private String getNextPolylineId() { - return "l" + polylineCounter++; - } - - private String getNextPolygonId() { - return "p" + polygonCounter++; - } - - /* - Camera - */ - - @Override - public CameraPosition getCameraPosition() throws RemoteException { - return GmsMapsTypeHelper.toCameraPosition(backendMap.getMapPosition()); - } - - @Override - public float getMaxZoomLevel() throws RemoteException { - return (float) backendMap.getViewport().limitScale(Double.MIN_VALUE); - } - - @Override - public float getMinZoomLevel() throws RemoteException { - return (float) backendMap.getViewport().limitScale(Double.MAX_VALUE); - } - - @Override - public void moveCamera(IObjectWrapper cameraUpdate) throws RemoteException { - CameraUpdate camUpdate = (CameraUpdate) ObjectWrapper.unwrap(cameraUpdate); - backendMap.applyCameraUpdate(camUpdate); - } - - @Override - public void animateCamera(IObjectWrapper cameraUpdate) throws RemoteException { - CameraUpdate camUpdate = (CameraUpdate) ObjectWrapper.unwrap(cameraUpdate); - backendMap.applyCameraUpdateAnimated(camUpdate, 1000); - } - - @Override - public void animateCameraWithCallback(IObjectWrapper cameraUpdate, ICancelableCallback callback) - throws RemoteException { - CameraUpdate camUpdate = (CameraUpdate) ObjectWrapper.unwrap(cameraUpdate); - backendMap.applyCameraUpdateAnimated(camUpdate, 1000); - } - - @Override - public void animateCameraWithDurationAndCallback(IObjectWrapper cameraUpdate, int duration, - ICancelableCallback callback) throws RemoteException { - CameraUpdate camUpdate = (CameraUpdate) ObjectWrapper.unwrap(cameraUpdate); - backendMap.applyCameraUpdateAnimated(camUpdate, duration); - } - - @Override - public IProjectionDelegate getProjection() throws RemoteException { - return projection; - } - - @Override - public void stopAnimation() throws RemoteException { - backendMap.stopAnimation(); - } - - @Override - public void onCameraUpdate(CameraPosition cameraPosition) { - if (onCameraChangeListener != null) { - try { - onCameraChangeListener.onCameraChange(cameraPosition); - } catch (RemoteException e) { - Log.w(TAG, e); - } - } - } - - /* - Markers, polylines, polygons, overlays, etc - */ - - @Override - public ICircleDelegate addCircle(CircleOptions options) throws RemoteException { - return backendMap.add(new CircleImpl(getNextCircleId(), options, this)); - } - - @Override - public IPolylineDelegate addPolyline(PolylineOptions options) throws RemoteException { - return backendMap.add(new PolylineImpl(getNextPolylineId(), options, this)); - } - - @Override - public IPolygonDelegate addPolygon(PolygonOptions options) throws RemoteException { - return backendMap.add(new PolygonImpl(getNextPolygonId(), options, this)); - } - - @Override - public IMarkerDelegate addMarker(MarkerOptions options) throws RemoteException { - return backendMap.add(new MarkerImpl(getNextMarkerId(), options, this)); - } - - @Override - public IGroundOverlayDelegate addGroundOverlay(GroundOverlayOptions options) - throws RemoteException { - Log.d(TAG, "not yet usable: addGroundOverlay"); - return new GroundOverlayImpl(options); // TODO - } - - @Override - public ITileOverlayDelegate addTileOverlay(TileOverlayOptions options) throws RemoteException { - Log.d(TAG, "not yet usable: addTileOverlay"); - return new TileOverlayImpl(); // TODO - } - - @Override - public void setInfoWindowAdapter(IInfoWindowAdapter adapter) throws RemoteException { - Log.d(TAG, "not yet usable: setInfoWindowAdapter"); - } - - @Override - public void clear() throws RemoteException { - backendMap.clear(); - markerCounter = 0; - circleCounter = 0; - polylineCounter = 0; - polygonCounter = 0; - } - - @Override - public void update(Markup markup) { - backendMap.update(markup); - } - - @Override - public void remove(Markup markup) { - backendMap.remove(markup); - } - - @Override - public boolean onClick(Markup markup) { - if (markup instanceof IMarkerDelegate) { - if (onMarkerClickListener != null) { - try { - if (onMarkerClickListener.onMarkerClick((IMarkerDelegate) markup)) - return true; - } catch (RemoteException e) { - Log.w(TAG, e); - } - } - // TODO: open InfoWindow - } - return false; - } - - @Override - public void onDragStart(Markup markup) { - backendMap.setScrollGesturesEnabled(false); - backendMap.setRotateGesturesEnabled(false); - backendMap.setTiltGesturesEnabled(false); - backendMap.setZoomGesturesEnabled(false); - if (markup instanceof IMarkerDelegate) { - if (onMarkerDragListener != null) { - try { - onMarkerDragListener.onMarkerDragStart((IMarkerDelegate) markup); - } catch (RemoteException e) { - Log.w(TAG, e); - } - } - } - } - - @Override - public void onDragStop(Markup markup) { - try { - backendMap.setScrollGesturesEnabled(uiSettings.isScrollGesturesEnabled()); - backendMap.setRotateGesturesEnabled(uiSettings.isRotateGesturesEnabled()); - backendMap.setTiltGesturesEnabled(uiSettings.isTiltGesturesEnabled()); - backendMap.setZoomGesturesEnabled(uiSettings.isZoomGesturesEnabled()); - } catch (RemoteException e) { - // Never happens, is local. - } - if (markup instanceof IMarkerDelegate) { - if (onMarkerDragListener != null) { - try { - onMarkerDragListener.onMarkerDragEnd((IMarkerDelegate) markup); - } catch (RemoteException e) { - Log.w(TAG, e); - } - } - } - } - - @Override - public void onDragProgress(Markup markup) { - if (markup instanceof IMarkerDelegate) { - if (onMarkerDragListener != null) { - try { - onMarkerDragListener.onMarkerDrag((IMarkerDelegate) markup); - } catch (RemoteException e) { - Log.w(TAG, e); - } - } - } - } - - /* - Map options - */ - - @Override - public int getMapType() throws RemoteException { - return 0; - } - - @Override - public void setMapType(int type) throws RemoteException { - - } - - @Override - public boolean isTrafficEnabled() throws RemoteException { - return false; - } - - @Override - public void setTrafficEnabled(boolean traffic) throws RemoteException { - Log.w(TAG, "Traffic not yet supported"); - } - - @Override - public boolean isIndoorEnabled() throws RemoteException { - return false; - } - - @Override - public void setIndoorEnabled(boolean indoor) throws RemoteException { - Log.w(TAG, "Indoor not yet supported"); - } - - @Override - public boolean isMyLocationEnabled() throws RemoteException { - return false; - } - - @Override - public void setMyLocationEnabled(boolean myLocation) throws RemoteException { - Log.w(TAG, "MyLocation not yet supported"); - boolean hasPermission = ContextCompat.checkSelfPermission(context, ACCESS_COARSE_LOCATION) == PERMISSION_GRANTED - || ContextCompat.checkSelfPermission(context, ACCESS_FINE_LOCATION) == PERMISSION_GRANTED; - if (!hasPermission) { - throw new SecurityException("Neither " + ACCESS_COARSE_LOCATION + " nor " + ACCESS_FINE_LOCATION + " granted."); - } - LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); - if (myLocation) { - locationManager.requestLocationUpdates(5000, 10, criteria, listener, Looper.getMainLooper()); - } else { - locationManager.removeUpdates(listener); - } - } - - @Override - public boolean isBuildingsEnabled() throws RemoteException { - return backendMap.hasBuilding(); - } - - @Override - public void setBuildingsEnabled(boolean buildingsEnabled) throws RemoteException { - backendMap.setBuildings(buildingsEnabled); - } - - /* - Ui Settings - */ - - @Override - public IUiSettingsDelegate getUiSettings() throws RemoteException { - Log.d(TAG, "getUiSettings: " + uiSettings); - return uiSettings; - } - - @Override - public void onUiSettingsChanged(UiSettingsImpl settings) throws RemoteException { - if (settings.isCompassEnabled()) { - Log.w(TAG, "Compass not yet supported"); - } - if (settings.isMyLocationButtonEnabled()) { - Log.w(TAG, "MyLocationButton not yet supported"); - } - if (settings.isZoomControlsEnabled()) { - Log.w(TAG, "ZoomControls not yet supported"); - } - backendMap.setScrollGesturesEnabled(settings.isScrollGesturesEnabled()); - backendMap.setRotateGesturesEnabled(settings.isRotateGesturesEnabled()); - backendMap.setTiltGesturesEnabled(settings.isTiltGesturesEnabled()); - backendMap.setZoomGesturesEnabled(settings.isZoomGesturesEnabled()); - } - - /* - Listener and callback setters - */ - - @Override - public void setOnCameraChangeListener(IOnCameraChangeListener listener) throws RemoteException { - Log.d(TAG, "setOnCameraChangeListener"); - this.onCameraChangeListener = listener; - } - - @Override - public void setOnMapClickListener(IOnMapClickListener listener) throws RemoteException { - Log.d(TAG, "setOnMapClickListener: not supported"); - } - - @Override - public void setOnMapLongClickListener(IOnMapLongClickListener listener) throws RemoteException { - Log.d(TAG, "setOnMapLongClickListener: not supported"); - } - - @Override - public void setOnMarkerClickListener(IOnMarkerClickListener listener) throws RemoteException { - Log.d(TAG, "setOnMarkerClickListener"); - this.onMarkerClickListener = listener; - } - - @Override - public void setOnMarkerDragListener(IOnMarkerDragListener listener) throws RemoteException { - Log.d(TAG, "setOnMarkerDragListener"); - this.onMarkerDragListener = listener; - } - - @Override - public void setOnInfoWindowClickListener(IOnInfoWindowClickListener listener) - throws RemoteException { - Log.d(TAG, "setOnInfoWindowClickListener: not supported"); - } - - @Override - public void setOnMyLocationChangeListener(IOnMyLocationChangeListener listener) - throws RemoteException { - Log.d(TAG, "setOnMyLocationChangeListener"); - this.onMyLocationChangeListener = listener; - } - - @Override - public void setOnMyLocationButtonClickListener(IOnMyLocationButtonClickListener listener) - throws RemoteException { - Log.d(TAG, "setOnMyLocationButtonClickListener: not supported"); - } - - @Override - public void setOnMapLoadedCallback(final IOnMapLoadedCallback callback) throws RemoteException { - Log.d(TAG, "setOnMapLoadedCallback"); - new Handler(context.getMainLooper()).postDelayed(new Runnable() { - @Override - public void run() { - Log.d(TAG, "Announce map loaded"); - if (callback != null) { - try { - callback.onMapLoaded(); - } catch (RemoteException e) { - Log.w(TAG, e); - } - } - } - }, 5000); - } - - @Override - public void setWatermarkEnabled(boolean watermark) throws RemoteException { - Log.d(TAG, "unimplemented Method: setWatermarkEnabled"); - - } - - @Override - public void onCreate(Bundle savedInstanceState) throws RemoteException { - Log.d(TAG, "unimplemented Method: onCreate"); - - } - - @Override - public void setCameraMoveStartedListener(IOnCameraMoveStartedListener listener) throws RemoteException { - Log.d(TAG, "unimplemented Method: setCameraMoveStartedListener"); - - } - - @Override - public void setCameraMoveListener(IOnCameraMoveListener listener) throws RemoteException { - Log.d(TAG, "unimplemented Method: setCameraMoveListener"); - - } - - @Override - public void setCameraMoveCanceledListener(IOnCameraMoveCanceledListener listener) throws RemoteException { - Log.d(TAG, "unimplemented Method: setCameraMoveCanceledListener"); - - } - - @Override - public void setCameraIdleListener(IOnCameraIdleListener listener) throws RemoteException { - Log.d(TAG, "unimplemented Method: setCameraIdleListener"); - - } - - @Override - public void onStart() throws RemoteException { - Log.d(TAG, "unimplemented Method: onStart"); - - } - - @Override - public void onStop() throws RemoteException { - Log.d(TAG, "unimplemented Method: onStop"); - - } - - /* - Misc - */ - - @Override - public IObjectWrapper getTestingHelper() throws RemoteException { - return null; - } - - @Override - public void snapshot(ISnapshotReadyCallback callback, IObjectWrapper bitmap) - throws RemoteException { - Bitmap b = (Bitmap) ObjectWrapper.unwrap(bitmap); - Log.d(TAG, "snapshot!: " + b); - backendMap.snapshot(b, callback); - } - - @Override - public void setPadding(int left, int top, int right, int bottom) throws RemoteException { - getView().setPadding(left, top, right, bottom); - } - - @Override - public Location getMyLocation() throws RemoteException { - return myLocation; - } - - @Override - public void setLocationSource(ILocationSourceDelegate locationSource) throws RemoteException { - Log.d(TAG, "setLocationSource: " + locationSource); - } - - @Override - public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { - if (super.onTransact(code, data, reply, flags)) return true; - Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags); - return false; - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/MapFragmentImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/MapFragmentImpl.java deleted file mode 100644 index 44521532..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/MapFragmentImpl.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.vtm; - -import android.app.Activity; -import android.content.Context; -import android.os.Bundle; -import android.os.Handler; -import android.os.Parcel; -import android.os.RemoteException; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import com.google.android.gms.dynamic.IObjectWrapper; -import com.google.android.gms.dynamic.ObjectWrapper; -import com.google.android.gms.maps.GoogleMapOptions; -import com.google.android.gms.maps.internal.IGoogleMapDelegate; -import com.google.android.gms.maps.internal.IMapFragmentDelegate; -import com.google.android.gms.maps.internal.IOnMapReadyCallback; - -public class MapFragmentImpl extends IMapFragmentDelegate.Stub { - private static final String TAG = "GmsMapFragImpl"; - - private GoogleMapImpl map; - private GoogleMapOptions options; - private Activity activity; - - public MapFragmentImpl(Activity activity) { - this.activity = activity; - } - - private GoogleMapImpl myMap() { - if (map == null) { - Log.d(TAG, "GoogleMap instance created"); - LayoutInflater inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - map = GoogleMapImpl.create(inflater.getContext(), options); - } - return map; - } - - @Override - public IGoogleMapDelegate getMap() throws RemoteException { - Log.d(TAG, "getMap"); - return myMap(); - } - - @Override - public void onInflate(IObjectWrapper activity, GoogleMapOptions options, - Bundle savedInstanceState) throws RemoteException { - if (options != null) this.options = options; - Log.d(TAG, "onInflate"); - } - - @Override - public void onCreate(Bundle savedInstanceState) throws RemoteException { - Log.d(TAG, "onCreate"); - //myMap().onCreate(savedInstanceState); - // TOOD: Certainly does not belong here and this way - Bundle mapState = savedInstanceState.getBundle("map_state"); - if (mapState != null) { - mapState.setClassLoader(GoogleMapOptions.class.getClassLoader()); - GoogleMapOptions options = mapState.getParcelable("MapOptions"); - if (options != null) this.options = options; - } - } - - @Override - public IObjectWrapper onCreateView(IObjectWrapper layoutInflater, IObjectWrapper container, - Bundle savedInstanceState) throws RemoteException { - Log.d(TAG, "onCreateView"); - if (map == null) { - LayoutInflater inflater = (LayoutInflater) ObjectWrapper.unwrap(layoutInflater); - map = GoogleMapImpl.create(inflater.getContext(), options); - //map.onCreate(savedInstanceState); - } else { - View view = map.getView(); - if (view.getParent() instanceof ViewGroup) { - ((ViewGroup) view.getParent()).removeView(view); - } - } - return ObjectWrapper.wrap(myMap().getView()); - } - - @Override - public void onResume() throws RemoteException { - Log.d(TAG, "onResume"); - myMap().onResume(); - } - - @Override - public void onPause() throws RemoteException { - Log.d(TAG, "onPause"); - myMap().onPause(); - } - - @Override - public void onDestroyView() throws RemoteException { - Log.d(TAG, "onDestroyView"); - } - - @Override - public void onDestroy() throws RemoteException { - Log.d(TAG, "onDestroy"); - myMap().onDestroy(); - } - - @Override - public void onLowMemory() throws RemoteException { - Log.d(TAG, "onLowMemory"); - } - - @Override - public void onEnterAmbient(Bundle bundle) throws RemoteException { - map.onEnterAmbient(bundle); - } - - @Override - public void onExitAmbient() throws RemoteException { - map.onExitAmbient(); - } - - @Override - public void onStart() throws RemoteException { - map.onStart(); - } - - @Override - public void onStop() throws RemoteException { - map.onStop(); - } - - @Override - public void onSaveInstanceState(Bundle outState) throws RemoteException { - Log.d(TAG, "onSaveInstanceState: " + outState); - //myMap().onSaveInstanceState(outState); - } - - @Override - public boolean isReady() throws RemoteException { - Log.d(TAG, "isReady"); - return map != null; - } - - @Override - public void getMapAsync(final IOnMapReadyCallback callback) throws RemoteException { - new Handler(activity.getMainLooper()).post(new Runnable() { - @Override - public void run() { - try { - callback.onMapReady(myMap()); - } catch (RemoteException e) { - Log.w(TAG, e); - } - } - }); - } - - @Override - public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { - if (super.onTransact(code, data, reply, flags)) return true; - Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags); - return false; - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/MapViewImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/MapViewImpl.java deleted file mode 100644 index c24ea52e..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/MapViewImpl.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.vtm; - -import android.content.Context; -import android.os.Bundle; -import android.os.Handler; -import android.os.Parcel; -import android.os.RemoteException; -import android.util.Log; -import android.view.LayoutInflater; - -import com.google.android.gms.dynamic.IObjectWrapper; -import com.google.android.gms.dynamic.ObjectWrapper; -import com.google.android.gms.maps.GoogleMapOptions; -import com.google.android.gms.maps.internal.IGoogleMapDelegate; -import com.google.android.gms.maps.internal.IMapViewDelegate; -import com.google.android.gms.maps.internal.IOnMapReadyCallback; - -public class MapViewImpl extends IMapViewDelegate.Stub { - private static final String TAG = "GmsMapViewImpl"; - - private GoogleMapImpl map; - private GoogleMapOptions options; - private Context context; - private IOnMapReadyCallback readyCallback; - - public MapViewImpl(Context context, GoogleMapOptions options) { - this.context = context; - this.options = options; - } - - private GoogleMapImpl myMap() { - if (map == null) { - Log.d(TAG, "GoogleMap instance created"); - LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - map = GoogleMapImpl.create(inflater.getContext(), options); - } - return map; - } - - @Override - public IGoogleMapDelegate getMap() throws RemoteException { - Log.d(TAG, "getMap"); - return myMap(); - } - - @Override - public void onCreate(Bundle savedInstanceState) throws RemoteException { - //myMap().onCreate(savedInstanceState); - Log.d(TAG, "onCreate"); - } - - @Override - public void onResume() throws RemoteException { - Log.d(TAG, "onResume"); - - myMap().onResume(); - if (readyCallback != null) { - try { - readyCallback.onMapReady(map); - readyCallback = null; - } catch (Exception e) { - Log.w(TAG, e); - } - } - } - - @Override - public void onPause() throws RemoteException { - Log.d(TAG, "onPause"); - myMap().onPause(); - } - - @Override - public void onDestroy() throws RemoteException { - Log.d(TAG, "onDestroy"); - myMap().onDestroy(); - } - - @Override - public void onLowMemory() throws RemoteException { - Log.d(TAG, "onLowMemory"); - } - - @Override - public void onSaveInstanceState(Bundle outState) throws RemoteException { - Log.d(TAG, "onSaveInstanceState: " + outState); - } - - @Override - public IObjectWrapper getView() throws RemoteException { - return ObjectWrapper.wrap(myMap().getView()); - } - - @Override - public void getMapAsync(final IOnMapReadyCallback callback) throws RemoteException { - Log.d(TAG, "getMapAsync"); - new Handler(context.getMainLooper()).post(new Runnable() { - @Override - public void run() { - try { - callback.onMapReady(myMap()); - } catch (RemoteException e) { - Log.w(TAG, e); - } - } - }); - } - - @Override - public void onEnterAmbient(Bundle bundle) throws RemoteException { - map.onEnterAmbient(bundle); - } - - @Override - public void onExitAmbient() throws RemoteException { - map.onExitAmbient(); - } - - @Override - public void onStart() throws RemoteException { - map.onStart(); - } - - @Override - public void onStop() throws RemoteException { - map.onStop(); - } - - @Override - public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { - if (super.onTransact(code, data, reply, flags)) return true; - Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags); - return false; - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ProjectionImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ProjectionImpl.java deleted file mode 100644 index f6fa1954..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ProjectionImpl.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.vtm; - -import android.os.RemoteException; - -import com.google.android.gms.dynamic.IObjectWrapper; -import com.google.android.gms.dynamic.ObjectWrapper; -import com.google.android.gms.maps.internal.IProjectionDelegate; -import com.google.android.gms.maps.model.LatLng; -import com.google.android.gms.maps.model.VisibleRegion; - -import org.oscim.core.Point; -import org.oscim.map.Viewport; - -public class ProjectionImpl extends IProjectionDelegate.Stub { - private Viewport viewport; - private float[] extents = new float[8]; - - public ProjectionImpl(Viewport viewport) { - this.viewport = viewport; - } - - @Override - public LatLng fromScreenLocation(IObjectWrapper obj) throws RemoteException { - Point point = GmsMapsTypeHelper - .fromPoint((android.graphics.Point) ObjectWrapper.unwrap(obj)); - return GmsMapsTypeHelper - .toLatLng(viewport.fromScreenPoint((float) point.x, (float) point.y)); - } - - @Override - public IObjectWrapper toScreenLocation(LatLng latLng) throws RemoteException { - Point point = new Point(); - viewport.toScreenPoint(GmsMapsTypeHelper.fromLatLng(latLng), point); - return ObjectWrapper.wrap(GmsMapsTypeHelper.toPoint(point)); - } - - @Override - public VisibleRegion getVisibleRegion() throws RemoteException { - viewport.getMapExtents(extents, 0); - // TODO: Support non-flat map extents - return new VisibleRegion(GmsMapsTypeHelper.toLatLngBounds(viewport.getBBox(null, 0))); - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ResourcesContainer.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ResourcesContainer.java deleted file mode 100644 index ab53e7e5..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ResourcesContainer.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.vtm; - -import android.content.res.Resources; - -public class ResourcesContainer { - private static Resources resources; - - public static void set(Resources resources) { - ResourcesContainer.resources = resources; - } - - public static Resources get() { - if (resources == null) { - throw new IllegalStateException("Resources have not been initialized"); - } else { - return resources; - } - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/UiSettingsImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/UiSettingsImpl.java deleted file mode 100644 index cb24de3c..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/UiSettingsImpl.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2019 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.maps.vtm; - -import android.os.RemoteException; -import com.google.android.gms.maps.internal.IUiSettingsDelegate; - -public class UiSettingsImpl extends IUiSettingsDelegate.Stub { - private boolean zoomControlsEnabled; - private boolean compassEnabled; - private boolean myLocationButtonEnabled; - private boolean scrollGesturesEnabled = true; - private boolean zoomGesturesEnabled = true; - private boolean tiltGesturesEnabled = true; - private boolean rotateGesturesEnabled = true; - private boolean allGesturesEnabled = true; - private boolean indoorLevelPickerEnabled = false; - private boolean mapToolbarEnabled = false; - private boolean scrollGesturesEnabledDuringRotateOrZoom = true; - - private UiSettingsListener listener; - - public UiSettingsImpl() { - } - - public UiSettingsImpl(UiSettingsListener listener) { - this.listener = listener; - } - - public void setListener(UiSettingsListener listener) { - this.listener = listener; - } - - @Override - public void setZoomControlsEnabled(boolean zoomControlsEnabled) throws RemoteException { - this.zoomControlsEnabled = zoomControlsEnabled; - listener.onUiSettingsChanged(this); - } - - @Override - public void setCompassEnabled(boolean compassEnabled) throws RemoteException { - this.compassEnabled = compassEnabled; - listener.onUiSettingsChanged(this); - } - - @Override - public void setMyLocationButtonEnabled(boolean myLocationButtonEnabled) throws RemoteException { - this.myLocationButtonEnabled = myLocationButtonEnabled; - listener.onUiSettingsChanged(this); - } - - @Override - public void setScrollGesturesEnabled(boolean scrollGesturesEnabled) throws RemoteException { - this.scrollGesturesEnabled = scrollGesturesEnabled; - listener.onUiSettingsChanged(this); - } - - @Override - public void setZoomGesturesEnabled(boolean zoomGestures) throws RemoteException { - this.zoomGesturesEnabled = zoomGestures; - listener.onUiSettingsChanged(this); - } - - @Override - public void setTiltGesturesEnabled(boolean tiltGesturesEnabled) throws RemoteException { - this.tiltGesturesEnabled = tiltGesturesEnabled; - listener.onUiSettingsChanged(this); - } - - @Override - public void setRotateGesturesEnabled(boolean rotateGesturesEnabled) throws RemoteException { - this.rotateGesturesEnabled = rotateGesturesEnabled; - listener.onUiSettingsChanged(this); - } - - @Override - public void setAllGesturesEnabled(boolean gestures) throws RemoteException { - scrollGesturesEnabled = gestures; - zoomGesturesEnabled = gestures; - tiltGesturesEnabled = gestures; - rotateGesturesEnabled = gestures; - listener.onUiSettingsChanged(this); - } - - @Override - public boolean isZoomControlsEnabled() throws RemoteException { - return zoomControlsEnabled; - } - - @Override - public boolean isCompassEnabled() throws RemoteException { - return compassEnabled; - } - - @Override - public boolean isMyLocationButtonEnabled() throws RemoteException { - return myLocationButtonEnabled; - } - - @Override - public boolean isScrollGesturesEnabled() throws RemoteException { - return scrollGesturesEnabled; - } - - @Override - public boolean isZoomGesturesEnabled() throws RemoteException { - return zoomGesturesEnabled; - } - - @Override - public boolean isTiltGesturesEnabled() throws RemoteException { - return tiltGesturesEnabled; - } - - @Override - public boolean isRotateGesturesEnabled() throws RemoteException { - return rotateGesturesEnabled; - } - - @Override - public void setIndoorLevelPickerEnabled(boolean indoorLevelPicker) throws RemoteException { - this.indoorLevelPickerEnabled = indoorLevelPicker; - listener.onUiSettingsChanged(this); - } - - @Override - public boolean isIndoorLevelPickerEnabled() throws RemoteException { - return indoorLevelPickerEnabled; - } - - @Override - public void setMapToolbarEnabled(boolean mapToolbar) throws RemoteException { - this.mapToolbarEnabled = mapToolbar; - listener.onUiSettingsChanged(this); - } - - @Override - public boolean isMapToolbarEnabled() throws RemoteException { - return mapToolbarEnabled; - } - - @Override - public void setScrollGesturesEnabledDuringRotateOrZoom(boolean scrollDuringZoom) throws RemoteException { - this.scrollGesturesEnabledDuringRotateOrZoom = scrollDuringZoom; - listener.onUiSettingsChanged(this); - } - - @Override - public boolean isScrollGesturesEnabledDuringRotateOrZoom() throws RemoteException { - return scrollGesturesEnabledDuringRotateOrZoom; - } - - public static interface UiSettingsListener { - void onUiSettingsChanged(UiSettingsImpl settings) throws RemoteException; - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/AbstractBitmapDescriptor.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/AbstractBitmapDescriptor.java deleted file mode 100644 index 92cee1c1..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/AbstractBitmapDescriptor.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.bitmap; - -import android.content.Context; -import android.graphics.Bitmap; - -public abstract class AbstractBitmapDescriptor { - - private Bitmap bitmap; - - protected abstract Bitmap generateBitmap(Context context); - - public Bitmap loadBitmap(Context context) { - if (bitmap == null) { - synchronized (this) { - if (bitmap == null) - bitmap = generateBitmap(context); - } - } - return bitmap; - } - - public Bitmap getBitmap() { - return bitmap; - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/AssetBitmapDescriptor.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/AssetBitmapDescriptor.java deleted file mode 100644 index 80070321..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/AssetBitmapDescriptor.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.bitmap; - -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; - -import java.io.IOException; - -public class AssetBitmapDescriptor extends AbstractBitmapDescriptor { - private String assetName; - - public AssetBitmapDescriptor(String assetName) { - this.assetName = assetName; - } - - @Override - protected Bitmap generateBitmap(Context context) { - try { - return BitmapFactory.decodeStream(context.getAssets().open(assetName)); - } catch (IOException e) { - e.printStackTrace(); - } - return null; - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/BitmapBitmapDescriptor.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/BitmapBitmapDescriptor.java deleted file mode 100644 index 6ccce321..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/BitmapBitmapDescriptor.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.bitmap; - -import android.content.Context; -import android.graphics.Bitmap; - -public class BitmapBitmapDescriptor extends AbstractBitmapDescriptor { - private Bitmap bitmap; - - public BitmapBitmapDescriptor(Bitmap bitmap) { - this.bitmap = bitmap; - } - - @Override - public Bitmap getBitmap() { - return bitmap; - } - - @Override - public Bitmap generateBitmap(Context context) { - return bitmap; - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/BitmapDescriptorFactoryImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/BitmapDescriptorFactoryImpl.java deleted file mode 100644 index e5374a62..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/BitmapDescriptorFactoryImpl.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.bitmap; - -import android.graphics.Bitmap; -import android.os.Parcel; -import android.os.RemoteException; -import android.util.Log; - -import com.google.android.gms.dynamic.IObjectWrapper; -import com.google.android.gms.dynamic.ObjectWrapper; -import com.google.android.gms.maps.model.internal.IBitmapDescriptorFactoryDelegate; - -public class BitmapDescriptorFactoryImpl extends IBitmapDescriptorFactoryDelegate.Stub { - private static final String TAG = "GmsBitmapDescFactory"; - - @Override - public IObjectWrapper fromResource(int resourceId) throws RemoteException { - return ObjectWrapper.wrap(new ResourceBitmapDescriptor(resourceId)); - } - - @Override - public IObjectWrapper fromAsset(String assetName) throws RemoteException { - return ObjectWrapper.wrap(new AssetBitmapDescriptor(assetName)); - } - - @Override - public IObjectWrapper fromFile(String fileName) throws RemoteException { - return ObjectWrapper.wrap(new FileBitmapDescriptor(fileName)); - } - - @Override - public IObjectWrapper defaultMarker() throws RemoteException { - return ObjectWrapper.wrap(DefaultBitmapDescriptor.DEFAULT_DESCRIPTOR); - } - - @Override - public IObjectWrapper defaultMarkerWithHue(float hue) throws RemoteException { - return ObjectWrapper.wrap(new DefaultBitmapDescriptor(hue)); - } - - @Override - public IObjectWrapper fromBitmap(Bitmap bitmap) throws RemoteException { - return ObjectWrapper.wrap(new BitmapBitmapDescriptor(bitmap)); - } - - @Override - public IObjectWrapper fromPath(String absolutePath) throws RemoteException { - return ObjectWrapper.wrap(new PathBitmapDescriptor(absolutePath)); - } - - @Override - public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { - if (super.onTransact(code, data, reply, flags)) return true; - Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags); - return false; - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/BitmapDescriptorImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/BitmapDescriptorImpl.java deleted file mode 100644 index dc12072d..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/BitmapDescriptorImpl.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.bitmap; - -import android.content.Context; -import android.graphics.Bitmap; -import android.util.Log; - -import com.google.android.gms.dynamic.IObjectWrapper; -import com.google.android.gms.dynamic.ObjectWrapper; -import com.google.android.gms.maps.model.BitmapDescriptor; - -import java.util.HashSet; -import java.util.Set; - -public class BitmapDescriptorImpl { - private BitmapDescriptor descriptor; - private boolean loadStarted = false; - private Set waitingForLoad = new HashSet(); - - public BitmapDescriptorImpl(IObjectWrapper remoteObject) { - this(new BitmapDescriptor(remoteObject)); - } - - public BitmapDescriptorImpl(BitmapDescriptor descriptor) { - this.descriptor = descriptor; - } - - public BitmapDescriptorImpl() { - this(new ObjectWrapper(new DefaultBitmapDescriptor(0))); - } - - public AbstractBitmapDescriptor getDescriptor() { - if (descriptor.getRemoteObject() == null) - return null; - Object unwrap = ObjectWrapper.unwrap(descriptor.getRemoteObject()); - if (unwrap instanceof AbstractBitmapDescriptor) { - return ((AbstractBitmapDescriptor) unwrap); - } else { - return null; - } - } - - public Bitmap getBitmap() { - if (getDescriptor() != null) { - return getDescriptor().getBitmap(); - } - return null; - } - - public synchronized boolean loadBitmapAsync(final Context context, Runnable after) { - if (getBitmap() != null) { - return false; - } - waitingForLoad.add(after); - if (loadStarted) - return true; - loadStarted = true; - if (getDescriptor() != null) { - new Thread(new Runnable() { - @Override - public void run() { - Log.d("BitmapDescriptor", "Start loading " + getDescriptor()); - if (getDescriptor().loadBitmap(context) != null) { - Set waitingForLoad; - synchronized (BitmapDescriptorImpl.this) { - waitingForLoad = BitmapDescriptorImpl.this.waitingForLoad; - } - for (Runnable after : waitingForLoad) { - after.run(); - } - } - Log.d("BitmapDescriptor", "Done loading " + getDescriptor()); - } - }).start(); - } - return true; - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/DefaultBitmapDescriptor.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/DefaultBitmapDescriptor.java deleted file mode 100644 index 340548c5..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/DefaultBitmapDescriptor.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.bitmap; - -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.graphics.Canvas; -import android.graphics.ColorFilter; -import android.graphics.ColorMatrix; -import android.graphics.ColorMatrixColorFilter; -import android.graphics.Paint; - -import com.google.android.gms.dynamic.ObjectWrapper; - -import org.microg.gms.maps.vtm.ResourcesContainer; -import org.microg.gms.maps.vtm.R; - -public class DefaultBitmapDescriptor extends AbstractBitmapDescriptor { - public static final DefaultBitmapDescriptor DEFAULT_DESCRIPTOR = new DefaultBitmapDescriptor(0); - public static final BitmapDescriptorImpl DEFAULT_DESCRIPTOR_IMPL = new BitmapDescriptorImpl(ObjectWrapper.wrap(DEFAULT_DESCRIPTOR)); - public static final int DEGREES = 360; - - private final float hue; - - public DefaultBitmapDescriptor(float hue) { - this.hue = hue > 180 ? -DEGREES + hue : hue; - } - - @Override - public Bitmap generateBitmap(Context context) { - Bitmap source; - if (this == DEFAULT_DESCRIPTOR) { - source = BitmapFactory.decodeResource(ResourcesContainer.get(), R.drawable.maps_default_marker); - } else { - source = DEFAULT_DESCRIPTOR.loadBitmap(context); - } - if (hue % DEGREES == 0) return source; - Paint paint = new Paint(); - paint.setColorFilter(adjustHue(hue)); - Bitmap bitmap = Bitmap.createBitmap(source.getWidth(), source.getHeight(), source.getConfig()); - Canvas canvas = new Canvas(bitmap); - canvas.drawBitmap(source, 0, 0, paint); - return bitmap; - } - - /** - * Creates a HUE ajustment ColorFilter - *

- * see http://groups.google.com/group/android-developers/browse_thread/thread/9e215c83c3819953 - * see http://gskinner.com/blog/archives/2007/12/colormatrix_cla.html - * - * @param value degrees to shift the hue. - */ - public static ColorFilter adjustHue(float value) { - ColorMatrix cm = new ColorMatrix(); - adjustHue(cm, value); - return new ColorMatrixColorFilter(cm); - } - - /** - * see http://groups.google.com/group/android-developers/browse_thread/thread/9e215c83c3819953 - * see http://gskinner.com/blog/archives/2007/12/colormatrix_cla.html - */ - public static void adjustHue(ColorMatrix cm, float value) { - value = cleanValue(value, 180f) / 180f * (float) Math.PI; - if (value == 0) { - return; - } - float cosVal = (float) Math.cos(value); - float sinVal = (float) Math.sin(value); - float lumR = 0.213f; - float lumG = 0.715f; - float lumB = 0.072f; - float[] mat = new float[]{lumR + cosVal * (1 - lumR) + sinVal * (-lumR), - lumG + cosVal * (-lumG) + sinVal * (-lumG), - lumB + cosVal * (-lumB) + sinVal * (1 - lumB), 0, 0, - lumR + cosVal * (-lumR) + sinVal * (0.143f), - lumG + cosVal * (1 - lumG) + sinVal * (0.140f), - lumB + cosVal * (-lumB) + sinVal * (-0.283f), 0, 0, - lumR + cosVal * (-lumR) + sinVal * (-(1 - lumR)), - lumG + cosVal * (-lumG) + sinVal * (lumG), - lumB + cosVal * (1 - lumB) + sinVal * (lumB), - 0, 0, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 0f, 1f}; - cm.postConcat(new ColorMatrix(mat)); - } - - protected static float cleanValue(float p_val, float p_limit) { - return Math.min(p_limit, Math.max(-p_limit, p_val)); - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/FileBitmapDescriptor.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/FileBitmapDescriptor.java deleted file mode 100644 index 6b109b50..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/FileBitmapDescriptor.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.bitmap; - -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; - -public class FileBitmapDescriptor extends AbstractBitmapDescriptor { - private String fileName; - - public FileBitmapDescriptor(String fileName) { - this.fileName = fileName; - } - - @Override - public Bitmap generateBitmap(Context context) { - return BitmapFactory.decodeFile(fileName); - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/PathBitmapDescriptor.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/PathBitmapDescriptor.java deleted file mode 100644 index 46ad1aa0..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/PathBitmapDescriptor.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.bitmap; - -public class PathBitmapDescriptor { - public PathBitmapDescriptor(String absolutePath) { - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/ResourceBitmapDescriptor.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/ResourceBitmapDescriptor.java deleted file mode 100644 index d06f38a0..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/ResourceBitmapDescriptor.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.bitmap; - -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; - -import androidx.core.content.ContextCompat; - -public class ResourceBitmapDescriptor extends AbstractBitmapDescriptor { - private int resourceId; - - public ResourceBitmapDescriptor(int resourceId) { - this.resourceId = resourceId; - } - - @Override - public Bitmap generateBitmap(Context context) { - return drawableToBitmap(context, ContextCompat.getDrawable(context.getApplicationContext(), resourceId)); - } - - public static Bitmap drawableToBitmap(Context context, Drawable drawable) { - if (drawable instanceof BitmapDrawable) { - return ((BitmapDrawable) drawable).getBitmap(); - } - - if (drawable.getIntrinsicWidth() <= 0 || drawable.getIntrinsicHeight() <= 0) { - return DefaultBitmapDescriptor.DEFAULT_DESCRIPTOR.loadBitmap(context); - } - - Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); - Canvas canvas = new Canvas(bitmap); - drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); - drawable.draw(canvas); - - return bitmap; - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/CameraUpdate.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/CameraUpdate.java deleted file mode 100644 index 69639bcc..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/CameraUpdate.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.camera; - -import org.oscim.map.Map; - -public interface CameraUpdate { - void apply(Map map); - void applyAnimated(Map map, int duration); -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/CameraUpdateFactoryImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/CameraUpdateFactoryImpl.java deleted file mode 100644 index 17020a86..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/CameraUpdateFactoryImpl.java +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.camera; - -import android.os.RemoteException; -import android.util.Log; - -import com.google.android.gms.dynamic.IObjectWrapper; -import com.google.android.gms.dynamic.ObjectWrapper; -import com.google.android.gms.maps.internal.ICameraUpdateFactoryDelegate; -import com.google.android.gms.maps.model.CameraPosition; -import com.google.android.gms.maps.model.LatLng; -import com.google.android.gms.maps.model.LatLngBounds; - -import org.microg.gms.maps.vtm.GmsMapsTypeHelper; -import org.oscim.core.MapPosition; -import org.oscim.map.Map; - -public class CameraUpdateFactoryImpl extends ICameraUpdateFactoryDelegate.Stub { - private static final String TAG = "GmsMapCamUpdateFactory"; - - private CameraUpdateFactoryImpl() { - - } - - private static CameraUpdateFactoryImpl instance; - public static CameraUpdateFactoryImpl get() { - if (instance == null) { - instance = new CameraUpdateFactoryImpl(); - } - return instance; - } - - @Override - public IObjectWrapper zoomIn() throws RemoteException { - Log.d(TAG, "zoomIn"); - return new ObjectWrapper(new MapPositionCameraUpdate() { - - @Override - MapPosition getMapPosition(Map map) { - MapPosition mapPosition = map.getMapPosition(); - mapPosition.setScale(GmsMapsTypeHelper.fromZoom( - GmsMapsTypeHelper.toZoom(mapPosition.getScale()) + 1)); - return mapPosition; - } - }); - } - - @Override - public IObjectWrapper zoomOut() throws RemoteException { - Log.d(TAG, "zoomOut"); - return new ObjectWrapper(new MapPositionCameraUpdate() { - @Override - MapPosition getMapPosition(Map map) { - MapPosition mapPosition = map.getMapPosition(); - mapPosition.setScale(GmsMapsTypeHelper.fromZoom( - GmsMapsTypeHelper.toZoom(mapPosition.getScale()) - 1)); - return mapPosition; - } - }); - } - - @Override - public IObjectWrapper scrollBy(final float x, final float y) throws RemoteException { - Log.d(TAG, "scrollBy"); - return new ObjectWrapper(new MapPositionCameraUpdate() { - @Override - MapPosition getMapPosition(Map map) { - MapPosition mapPosition = map.getMapPosition(); - mapPosition.setPosition(map.viewport() - .fromScreenPoint((float) (map.getWidth() / 2.0 + x), - (float) (map.getHeight() / 2.0 + y))); - return mapPosition; - } - }); - } - - @Override - public IObjectWrapper zoomTo(final float zoom) throws RemoteException { - Log.d(TAG, "zoomTo"); - return new ObjectWrapper(new MapPositionCameraUpdate() { - @Override - MapPosition getMapPosition(Map map) { - MapPosition mapPosition = map.getMapPosition(); - mapPosition.setScale(GmsMapsTypeHelper.fromZoom(zoom)); - return mapPosition; - } - }); - } - - @Override - public IObjectWrapper zoomBy(final float zoomDelta) throws RemoteException { - Log.d(TAG, "zoomBy"); - return new ObjectWrapper(new MapPositionCameraUpdate() { - @Override - MapPosition getMapPosition(Map map) { - MapPosition mapPosition = map.getMapPosition(); - mapPosition.setScale(GmsMapsTypeHelper.fromZoom( - GmsMapsTypeHelper.toZoom(mapPosition.getScale()) + zoomDelta)); - return mapPosition; - } - }); - } - - @Override - public IObjectWrapper zoomByWithFocus(final float zoomDelta, int x, int y) - throws RemoteException { - Log.d(TAG, "zoomByWithFocus"); - return new ObjectWrapper(new MapPositionCameraUpdate() { - @Override - MapPosition getMapPosition(Map map) { - MapPosition mapPosition = map.getMapPosition(); - mapPosition.setScale(GmsMapsTypeHelper.fromZoom( - GmsMapsTypeHelper.toZoom(mapPosition.getScale()) + zoomDelta)); - Log.w(TAG, "zoomBy with focus not yet supported"); // TODO - return mapPosition; - } - }); - } - - @Override - public IObjectWrapper newCameraPosition(final CameraPosition cameraPosition) - throws RemoteException { - Log.d(TAG, "newCameraPosition"); - return new ObjectWrapper(new MapPositionCameraUpdate() { - @Override - MapPosition getMapPosition(Map map) { - return GmsMapsTypeHelper.fromCameraPosition(cameraPosition); - } - }); - } - - @Override - public IObjectWrapper newLatLng(final LatLng latLng) throws RemoteException { - Log.d(TAG, "newLatLng"); - return new ObjectWrapper(new MapPositionCameraUpdate() { - @Override - MapPosition getMapPosition(Map map) { - MapPosition mapPosition = map.getMapPosition(); - mapPosition.setPosition(GmsMapsTypeHelper.fromLatLng(latLng)); - return mapPosition; - } - }); - } - - @Override - public IObjectWrapper newLatLngZoom(final LatLng latLng, final float zoom) - throws RemoteException { - Log.d(TAG, "newLatLngZoom"); - return new ObjectWrapper(new MapPositionCameraUpdate() { - @Override - MapPosition getMapPosition(Map map) { - MapPosition mapPosition = map.getMapPosition(); - mapPosition.setPosition(GmsMapsTypeHelper.fromLatLng(latLng)); - mapPosition.setScale(GmsMapsTypeHelper.fromZoom(zoom)); - return mapPosition; - } - }); - } - - @Override - public IObjectWrapper newLatLngBounds(final LatLngBounds bounds, int padding) throws RemoteException { - Log.d(TAG, "newLatLngBounds"); - return new ObjectWrapper(new MapPositionCameraUpdate() { - @Override - MapPosition getMapPosition(Map map) { - MapPosition mapPosition = map.getMapPosition(); - mapPosition.setByBoundingBox(GmsMapsTypeHelper.fromLatLngBounds(bounds), - map.getWidth(), map.getHeight()); - return mapPosition; - } - }); - } - - @Override - public IObjectWrapper newLatLngBoundsWithSize(final LatLngBounds bounds, final int width, final int height, int padding) - throws RemoteException { - Log.d(TAG, "newLatLngBoundsWithSize"); - return new ObjectWrapper(new MapPositionCameraUpdate() { - @Override - MapPosition getMapPosition(Map map) { - MapPosition mapPosition = map.getMapPosition(); - mapPosition.setByBoundingBox(GmsMapsTypeHelper.fromLatLngBounds(bounds), - width, height); - return mapPosition; - } - }); - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/MapPositionCameraUpdate.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/MapPositionCameraUpdate.java deleted file mode 100644 index fa5ebce2..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/MapPositionCameraUpdate.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.camera; - -import org.oscim.core.MapPosition; -import org.oscim.map.Map; - -public abstract class MapPositionCameraUpdate implements CameraUpdate { - - abstract MapPosition getMapPosition(Map map); - - @Override - public void apply(Map map) { - map.setMapPosition(getMapPosition(map)); - } - - @Override - public void applyAnimated(Map map, int duration) { - map.animator().animateTo(duration, getMapPosition(map)); - } - - public static CameraUpdate directMapPosition(final MapPosition position) { - return new MapPositionCameraUpdate() { - @Override - MapPosition getMapPosition(Map map) { - return position; - } - }; - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/NoCameraUpdate.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/NoCameraUpdate.java deleted file mode 100644 index a24a6d22..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/NoCameraUpdate.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.camera; - -import org.oscim.map.Map; - -public class NoCameraUpdate implements CameraUpdate { - @Override - public void apply(Map map) { - - } - - @Override - public void applyAnimated(Map map, int duration) { - - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/data/SharedTileCache.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/data/SharedTileCache.java deleted file mode 100644 index 3cdd61eb..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/data/SharedTileCache.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.data; - -import android.content.ContentValues; -import android.content.Context; -import android.database.Cursor; - -import org.oscim.core.Tile; -import org.oscim.tiling.ITileCache; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.ArrayList; - -public class SharedTileCache implements ITileCache { - private final ArrayList cacheBuffers; - private final Context context; - - public SharedTileCache(Context context) { - this.context = context; - this.cacheBuffers = new ArrayList(); - } - - @Override - public TileWriter writeTile(Tile tile) { - ByteArrayOutputStream os; - synchronized (this.cacheBuffers) { - if (this.cacheBuffers.isEmpty()) { - os = new ByteArrayOutputStream('耀'); - } else { - os = this.cacheBuffers.remove(this.cacheBuffers.size() - 1); - } - } - - return new CacheTileWriter(tile, os); - } - - public void saveTile(Tile tile, ByteArrayOutputStream data, boolean success) { - byte[] bytes = null; - if (success) { - bytes = data.toByteArray(); - } - - synchronized (this.cacheBuffers) { - data.reset(); - this.cacheBuffers.add(data); - } - - if (success) { - ContentValues values = new ContentValues(); - values.put("x", tile.tileX); - values.put("y", tile.tileY); - values.put("z", tile.zoomLevel); - values.put("time", 0); - values.put("last_access", 0); - values.put("data", bytes); - context.getContentResolver().insert(SharedTileProvider.PROVIDER_URI, values); - } - } - - @Override - public TileReader getTile(Tile tile) { - Cursor cursor = context.getContentResolver().query(SharedTileProvider.PROVIDER_URI, new String[]{"data"}, "z=? AND x=? AND y=?", new String[]{String.valueOf(tile.zoomLevel), String.valueOf(tile.tileX), String.valueOf(tile.tileY)}, null); - if (cursor != null) { - if (!cursor.moveToFirst()) { - cursor.close(); - return null; - } else { - ByteArrayInputStream in = new ByteArrayInputStream(cursor.getBlob(0)); - cursor.close(); - return new CacheTileReader(tile, in); - } - } - return null; - } - - @Override - public void setCacheSize(long l) { - - } - - class CacheTileWriter implements TileWriter { - final ByteArrayOutputStream os; - final Tile tile; - - CacheTileWriter(Tile tile, ByteArrayOutputStream os) { - this.tile = tile; - this.os = os; - } - - public Tile getTile() { - return tile; - } - - public OutputStream getOutputStream() { - return os; - } - - public void complete(boolean success) { - saveTile(tile, os, success); - } - } - - class CacheTileReader implements TileReader { - final InputStream is; - final Tile tile; - - public CacheTileReader(Tile tile, InputStream is) { - this.tile = tile; - this.is = is; - } - - public Tile getTile() { - return tile; - } - - public InputStream getInputStream() { - return is; - } - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/data/SharedTileProvider.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/data/SharedTileProvider.java deleted file mode 100644 index 3a322430..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/data/SharedTileProvider.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.data; - -import android.content.ContentProvider; -import android.content.ContentValues; -import android.content.Context; -import android.database.Cursor; -import android.database.sqlite.SQLiteDatabase; -import android.database.sqlite.SQLiteOpenHelper; -import android.net.Uri; - -/* - * TODO: Writing to cache should be protected, tiles should be downloaded by service instead of client app. - */ -public class SharedTileProvider extends ContentProvider { - private static final String DB_NAME = "tilecache.db"; - public static final String PROVIDER_NAME = "org.microg.gms.maps.vtm.tile"; - public static final Uri PROVIDER_URI = Uri.parse("content://" + PROVIDER_NAME); - - private SQLiteHelper sqLiteHelper; - - public SharedTileProvider() { - } - - @Override - public int delete(Uri uri, String selection, String[] selectionArgs) { - // Implement this to handle requests to delete one or more rows. - throw new UnsupportedOperationException("Not yet implemented"); - } - - @Override - public String getType(Uri uri) { - return "vnd.android.cursor.item/org.mgoogle.gms.map.tile"; - } - - @Override - public Uri insert(Uri uri, ContentValues values) { - sqLiteHelper.getWritableDatabase().insert("tiles", null, values); - return PROVIDER_URI; - } - - @Override - public boolean onCreate() { - sqLiteHelper = new SQLiteHelper(getContext(), DB_NAME); - return true; - } - - @Override - public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { - return sqLiteHelper.getReadableDatabase().query("tiles", projection, selection, selectionArgs, null, null, sortOrder); - } - - @Override - public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { - return sqLiteHelper.getWritableDatabase().update("tiles", values, selection, selectionArgs); - } - - class SQLiteHelper extends SQLiteOpenHelper { - private static final int DATABASE_VERSION = 1; - private static final String TILE_SCHEMA = "CREATE TABLE tiles(x INTEGER NOT NULL,y INTEGER NOT NULL,z INTEGER NOT NULL,time LONG NOT NULL,last_access LONG NOT NULL,data BLOB,PRIMARY KEY(x,y,z));"; - - public SQLiteHelper(Context context, String dbName) { - super(context, dbName, null, DATABASE_VERSION); - } - - public void onCreate(SQLiteDatabase db) { - db.execSQL(TILE_SCHEMA); - } - - public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { - db.execSQL("DROP TABLE IF EXISTS tiles"); - this.onCreate(db); - } - - public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) { - this.onUpgrade(db, oldVersion, newVersion); - } - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/CircleImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/CircleImpl.java deleted file mode 100644 index 18b4a999..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/CircleImpl.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.markup; - -import android.os.RemoteException; - -import com.google.android.gms.maps.model.CircleOptions; -import com.google.android.gms.maps.model.LatLng; -import com.google.android.gms.maps.model.internal.ICircleDelegate; - -import org.microg.gms.maps.vtm.GmsMapsTypeHelper; -import org.oscim.layers.vector.geometries.CircleDrawable; -import org.oscim.layers.vector.geometries.Drawable; -import org.oscim.layers.vector.geometries.Style; -import org.oscim.map.Map; - -public class CircleImpl extends ICircleDelegate.Stub implements DrawableMarkup { - - private final String id; - private final CircleOptions options; - private final MarkupListener listener; - private boolean removed = false; - - public CircleImpl(String id, CircleOptions options, MarkupListener listener) { - this.id = id; - this.listener = listener; - this.options = options == null ? new CircleOptions() : options; - } - - @Override - public void remove() throws RemoteException { - listener.remove(this); - removed = true; - } - - @Override - public String getId() { - return id; - } - - @Override - public void setCenter(LatLng center) throws RemoteException { - options.center(center); - listener.update(this); - } - - @Override - public LatLng getCenter() throws RemoteException { - return options.getCenter(); - } - - @Override - public void setRadius(double radius) throws RemoteException { - options.radius(radius); - listener.update(this); - } - - @Override - public double getRadius() throws RemoteException { - return options.getRadius(); - } - - @Override - public void setStrokeWidth(float width) throws RemoteException { - options.strokeWidth(width); - listener.update(this); - } - - @Override - public float getStrokeWidth() throws RemoteException { - return options.getStrokeWidth(); - } - - @Override - public void setStrokeColor(int color) throws RemoteException { - options.strokeColor(color); - listener.update(this); - } - - @Override - public int getStrokeColor() throws RemoteException { - return options.getStrokeColor(); - } - - @Override - public void setFillColor(int color) throws RemoteException { - options.fillColor(color); - listener.update(this); - } - - @Override - public int getFillColor() throws RemoteException { - return options.getFillColor(); - } - - @Override - public void setZIndex(float zIndex) throws RemoteException { - options.zIndex(zIndex); - listener.update(this); - } - - @Override - public float getZIndex() { - return options.getZIndex(); - } - - @Override - public void setVisible(boolean visible) throws RemoteException { - options.visible(visible); - listener.update(this); - } - - @Override - public boolean isVisible() { - return options.isVisible(); - } - - @Override - public boolean equalsRemote(ICircleDelegate other) throws RemoteException { - return other != null && other.getId().equals(getId()); - } - - @Override - public int hashCodeRemote() throws RemoteException { - return id.hashCode(); - } - - @Override - public boolean onClick() { - return listener.onClick(this); - } - - @Override - public void onDragStart() { - listener.onDragStart(this); - } - - @Override - public void onDragStop() { - listener.onDragStop(this); - } - - @Override - public void onDragProgress() { - listener.onDragProgress(this); - } - - @Override - public Drawable getDrawable(Map map) { - if (!isVisible() || removed) return null; - return new CircleDrawable( - GmsMapsTypeHelper.fromLatLng(options.getCenter()), - options.getRadius() / 1000.0, - Style.builder() - .strokeColor(options.getStrokeColor()) - .fillAlpha(1) - .fillColor(options.getFillColor()) - .strokeWidth(options.getStrokeWidth()).build()); - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/ClearableVectorLayer.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/ClearableVectorLayer.java deleted file mode 100644 index 4dedd470..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/ClearableVectorLayer.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.markup; - -import org.oscim.layers.vector.VectorLayer; -import org.oscim.map.Map; - -public class ClearableVectorLayer extends VectorLayer { - public ClearableVectorLayer(Map map) { - super(map); - } - - public void clear() { - mDrawables.clear(); - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/DrawableMarkup.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/DrawableMarkup.java deleted file mode 100644 index c91dd8d6..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/DrawableMarkup.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.markup; - -import org.oscim.layers.vector.geometries.Drawable; -import org.oscim.map.Map; - -public interface DrawableMarkup extends Markup { - float getZIndex(); - - Drawable getDrawable(Map map); -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/GroundOverlayImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/GroundOverlayImpl.java deleted file mode 100644 index a577bd2e..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/GroundOverlayImpl.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.markup; - -import android.os.RemoteException; -import com.google.android.gms.dynamic.IObjectWrapper; -import com.google.android.gms.maps.model.GroundOverlayOptions; -import com.google.android.gms.maps.model.LatLng; -import com.google.android.gms.maps.model.LatLngBounds; -import com.google.android.gms.maps.model.internal.IGroundOverlayDelegate; - -public class GroundOverlayImpl extends IGroundOverlayDelegate.Stub { - private LatLng position; - private float transparency; - private float zIndex; - private boolean visible; - private String id; - private float width; - private float height; - private float bearing; - - public GroundOverlayImpl(GroundOverlayOptions options) { - - } - - @Override - public void remove() throws RemoteException { - - } - - @Override - public String getId() throws RemoteException { - return id; - } - - @Override - public void setPosition(LatLng pos) throws RemoteException { - this.position = pos; - } - - @Override - public LatLng getPosition() throws RemoteException { - return position; - } - - @Override - public void setDimension(float dimension) throws RemoteException { - setDimensions(dimension, dimension); - } - - @Override - public void setDimensions(float width, float height) throws RemoteException { - this.width = width; - this.height = height; - } - - @Override - public float getWidth() throws RemoteException { - return width; - } - - @Override - public float getHeight() throws RemoteException { - return height; - } - - @Override - public void setPositionFromBounds(LatLngBounds bounds) throws RemoteException { - - } - - @Override - public LatLngBounds getBounds() throws RemoteException { - return null; - } - - @Override - public void setBearing(float bearing) throws RemoteException { - this.bearing = bearing; - } - - @Override - public float getBearing() throws RemoteException { - return bearing; - } - - @Override - public void setZIndex(float zIndex) throws RemoteException { - this.zIndex = zIndex; - } - - @Override - public float getZIndex() throws RemoteException { - return zIndex; - } - - @Override - public void setVisible(boolean visible) throws RemoteException { - this.visible = visible; - } - - @Override - public boolean isVisible() throws RemoteException { - return visible; - } - - @Override - public void setTransparency(float transparency) throws RemoteException { - this.transparency = transparency; - } - - @Override - public float getTransparency() throws RemoteException { - return transparency; - } - - @Override - public boolean equalsRemote(IGroundOverlayDelegate other) throws RemoteException { - return other != null && other.getId().equals(getId()); - } - - @Override - public int hashCodeRemote() throws RemoteException { - return id.hashCode(); - } - - @Override - public void todo(IObjectWrapper obj) throws RemoteException { - - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/InfoWindow.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/InfoWindow.java deleted file mode 100644 index 95a72ae0..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/InfoWindow.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.markup; - -import android.content.Context; -import android.view.View; -import android.widget.FrameLayout; -import android.widget.LinearLayout; -import android.widget.TextView; -import com.google.android.gms.maps.model.internal.IMarkerDelegate; -import org.microg.gms.maps.vtm.GoogleMapImpl; -import org.microg.gms.maps.vtm.ResourcesContainer; -import org.microg.gms.maps.vtm.R; - -import static android.os.Build.VERSION.SDK_INT; -import static android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1; - -public class InfoWindow { - private static final String TAG = InfoWindow.class.getName(); - private Context context; - private View window; - private GoogleMapImpl map; - private MarkerImpl marker; - - public InfoWindow(Context context, final GoogleMapImpl map, final MarkerImpl marker) { - super(); - this.context = context; - this.map = map; - this.marker = marker; - } - - public void setWindow(View view) { - window = view; - if (window != null) { - window.measure(0, 0); - } - } - - public boolean isComplete() { - return window != null; - } - - public void setContent(View view) { - if (view == null) - return; - setWindow(new DefaultWindow(view)); - } - - public void buildDefault() { - if (marker.getTitle() != null) - setContent(new DefaultContent()); - } - - public void destroy() { - if (window instanceof DefaultWindow) { - ((DefaultWindow) window).removeAllViews(); - } - } - - public IMarkerDelegate getMarker() { - return marker; - } - - /* - @Override - public void draw(Canvas canvas, MapView mapView, boolean shadow) { - if (window != null && marker.getHeight() != -1 && !shadow) { - try { - Log.d(TAG, "draw InfoWindow"); - window.measure(0, 0); - window.layout(0, 0, window.getMeasuredWidth(), window.getMeasuredHeight()); - //Point point = mapView.getProjection().toPixels(marker.getPosition().toGeoPoint(), null); - - // osmdroid 4.1 bugfix - Point zero = mapView.getProjection().toPixels(new GeoPoint(0, 0), null); - point.offset(-zero.x, -zero.y); - - - - point.offset(-window.getMeasuredWidth() / 2, -window.getMeasuredHeight() - marker.getHeight()); - Log.d(TAG, point.toString()); - canvas.save(); - canvas.translate(point.x, point.y); - window.draw(canvas); - canvas.restore(); - } catch (Exception e) { - // This is not remote... - } - } - } - - @Override - public boolean onTap(GeoPoint p, MapView mapView) { - try { - IOnInfoWindowClickListener listener = null; //map.getInfoWindowClickListener(); - if (listener != null) { - Point clickPoint = mapView.getProjection().toPixels(p, null); - Point markerPoint = mapView.getProjection().toPixels(marker.getPosition().toGeoPoint(), null); - Rect rect = new Rect(markerPoint.x - (window.getMeasuredWidth() / 2), - markerPoint.y - marker.getHeight() - window.getMeasuredHeight(), - markerPoint.x + (window.getMeasuredWidth() / 2), - markerPoint.y - marker.getHeight()); - if (rect.contains(clickPoint.x, clickPoint.y)) { - try { - listener.onInfoWindowClick(marker); - } catch (RemoteException e) { - Log.w(TAG, e); - } - return true; - } - - } - } catch (Exception e) { - // This is not remote... - } - return false; - } -*/ - - private class DefaultWindow extends FrameLayout { - @SuppressWarnings("deprecation") - public DefaultWindow(View view) { - super(context); - addView(view); - if (SDK_INT > ICE_CREAM_SANDWICH_MR1) { - setBackground(ResourcesContainer.get().getDrawable(R.drawable.maps_default_window)); - } else { - setBackgroundDrawable(ResourcesContainer.get().getDrawable(R.drawable.maps_default_window)); - } - } - } - - private class DefaultContent extends LinearLayout { - public DefaultContent() { - super(context); - setOrientation(LinearLayout.VERTICAL); - TextView title = new TextView(context); - title.setTextAppearance(context, - android.R.style.TextAppearance_DeviceDefault_Medium_Inverse); - title.setText(marker.getTitle()); - addView(title); - if (marker.getSnippet() != null) { - TextView snippet = new TextView(context); - snippet.setTextAppearance(context, - android.R.style.TextAppearance_DeviceDefault_Inverse); - snippet.setText(marker.getSnippet()); - addView(snippet); - } - } - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/MarkerImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/MarkerImpl.java deleted file mode 100644 index 83688e2e..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/MarkerImpl.java +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.markup; - -import android.content.Context; -import android.graphics.Bitmap; -import android.os.RemoteException; -import android.util.Log; - -import com.google.android.gms.dynamic.IObjectWrapper; -import com.google.android.gms.dynamic.ObjectWrapper; -import com.google.android.gms.maps.model.LatLng; -import com.google.android.gms.maps.model.MarkerOptions; -import com.google.android.gms.maps.model.internal.IMarkerDelegate; - -import org.microg.gms.maps.vtm.GmsMapsTypeHelper; -import org.microg.gms.maps.vtm.bitmap.BitmapDescriptorImpl; -import org.microg.gms.maps.vtm.bitmap.DefaultBitmapDescriptor; -import org.oscim.android.canvas.AndroidBitmap; -import org.oscim.layers.marker.MarkerItem; -import org.oscim.layers.marker.MarkerSymbol; - -public class MarkerImpl extends IMarkerDelegate.Stub implements MarkerItemMarkup { - private static final String TAG = "GmsMapMarkerImpl"; - - private final String id; - private final MarkerOptions options; - private final MarkupListener listener; - private BitmapDescriptorImpl icon; - private AndroidBitmap oldBitmap; - private boolean removed = false; - private IObjectWrapper tag = null; - - public MarkerImpl(String id, MarkerOptions options, MarkupListener listener) { - this.id = id; - this.listener = listener; - this.options = options == null ? new MarkerOptions() : options; - if (options.getPosition() == null) { - options.position(new LatLng(0, 0)); - } - icon = options.getIcon() == null ? null : new BitmapDescriptorImpl(options.getIcon()); - Log.d(TAG, "New marker " + id + " with title " + options.getTitle() + " @ " + - options.getPosition()); - } - - @Override - public void remove() { - listener.remove(this); - removed = true; - icon = null; - oldBitmap = null; - } - - @Override - public String getId() { - return id; - } - - @Override - public void setPosition(LatLng pos) { - options.position(pos); - listener.update(this); - } - - @Override - public LatLng getPosition() { - return options.getPosition(); - } - - @Override - public void setTitle(String title) { - options.title(title); - listener.update(this); - } - - @Override - public String getTitle() { - return options.getTitle(); - } - - @Override - public void setSnippet(String snippet) { - options.snippet(snippet); - } - - @Override - public String getSnippet() { - return options.getSnippet(); - } - - @Override - public void setDraggable(boolean drag) { - options.draggable(drag); - } - - @Override - public boolean isDraggable() { - return options.isDraggable(); - } - - @Override - public void showInfoWindow() { - - } - - @Override - public void hideInfoWindow() { - - } - - @Override - public boolean isInfoWindowShown() { - return false; - } - - @Override - public void setVisible(boolean visible) { - options.visible(visible); - } - - @Override - public boolean isVisible() { - return options.isVisible(); - } - - @Override - public boolean equalsRemote(IMarkerDelegate other) throws RemoteException { - return other != null && other.getId().equals(getId()); - } - - @Override - public int hashCodeRemote() { - return hashCode(); - } - - @Override - public int hashCode() { - return super.hashCode(); - } - - @Override - public void setIcon(IObjectWrapper obj) { - if (obj == null) { - icon = new BitmapDescriptorImpl(); - } else { - icon = new BitmapDescriptorImpl(obj); - } - listener.update(this); - } - - @Override - public void setAnchor(float x, float y) { - options.anchor(x, y); - listener.update(this); - } - - @Override - public void setFlat(boolean flat) { - options.flat(flat); - listener.update(this); - } - - @Override - public boolean isFlat() { - return options.isFlat(); - } - - @Override - public void setRotation(float rotation) { - options.rotation(rotation); - listener.update(this); - } - - @Override - public float getRotation() { - return options.getRotation(); - } - - @Override - public void setInfoWindowAnchor(float x, float y) { - options.infoWindowAnchor(x, y); - } - - @Override - public void setAlpha(float alpha) { - options.alpha(alpha); - listener.update(this); - } - - @Override - public float getAlpha() { - return options.getAlpha(); - } - - public int getHeight() { - Bitmap bitmap = icon.getBitmap(); - if (bitmap == null) - return -1; - return bitmap.getHeight(); - } - - @Override - public boolean onClick() { - return listener.onClick(this); - } - - @Override - public void onDragStart() { - listener.onDragStart(this); - } - - @Override - public void onDragStop() { - listener.onDragStop(this); - } - - @Override - public void onDragProgress() { - listener.onDragProgress(this); - } - - @Override - public MarkerItem getMarkerItem(Context context) { - if (removed) return null; - MarkerItem item = new MarkerItem(getId(), getTitle(), getSnippet(), - GmsMapsTypeHelper.fromLatLng(getPosition())); - BitmapDescriptorImpl icon = this.icon; - if (icon == null) - icon = DefaultBitmapDescriptor.DEFAULT_DESCRIPTOR_IMPL; - if (icon.getBitmap() != null) { - oldBitmap = new AndroidBitmap(icon.getBitmap()); - prepareMarkerIcon(item); - } else { - if (!icon.loadBitmapAsync(context, new Runnable() { - @Override - public void run() { - listener.update(MarkerImpl.this); - } - })) { - // Was loaded since last check... - oldBitmap = new AndroidBitmap(icon.getBitmap()); - prepareMarkerIcon(item); - } - // Keep old icon while loading new - if (oldBitmap != null) { - prepareMarkerIcon(item); - } - } - return item; - } - - private void prepareMarkerIcon(MarkerItem item) { - item.setMarker(new MarkerSymbol(oldBitmap, options.getAnchorU(), options.getAnchorV(), !options.isFlat())); - } - - @Override - public void setZIndex(float zIndex) { - options.zIndex(zIndex); - } - - @Override - public float getZIndex() { - return options.getZIndex(); - } - - @Override - public void setTag(IObjectWrapper obj) { - this.tag = obj; - } - - @Override - public IObjectWrapper getTag() { - return this.tag == null ? ObjectWrapper.wrap(null) : this.tag; - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/MarkerItemMarkup.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/MarkerItemMarkup.java deleted file mode 100644 index e243d88d..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/MarkerItemMarkup.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.markup; - -import android.content.Context; - -import com.google.android.gms.maps.model.LatLng; - -import org.oscim.layers.marker.MarkerItem; - -public interface MarkerItemMarkup extends Markup { - MarkerItem getMarkerItem(Context context); - - boolean isDraggable(); - - LatLng getPosition(); - - void setPosition(LatLng latLng); -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/Markup.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/Markup.java deleted file mode 100644 index 583343d8..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/Markup.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.markup; - -public interface Markup { - String getId(); - - boolean onClick(); - - void onDragStart(); - void onDragStop(); - void onDragProgress(); - - interface MarkupListener { - void update(Markup markup); - - void remove(Markup markup); - - boolean onClick(Markup markup); - - void onDragStart(Markup markup); - - void onDragStop(Markup markup); - - void onDragProgress(Markup markup); - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/PolygonImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/PolygonImpl.java deleted file mode 100644 index d17f647b..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/PolygonImpl.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.markup; - -import android.os.RemoteException; - -import com.google.android.gms.maps.model.LatLng; -import com.google.android.gms.maps.model.PolygonOptions; -import com.google.android.gms.maps.model.internal.IPolygonDelegate; - -import org.microg.gms.maps.vtm.GmsMapsTypeHelper; -import org.oscim.core.GeoPoint; -import org.oscim.layers.vector.geometries.Drawable; -import org.oscim.layers.vector.geometries.PolygonDrawable; -import org.oscim.layers.vector.geometries.Style; -import org.oscim.map.Map; - -import java.util.ArrayList; -import java.util.List; - -public class PolygonImpl extends IPolygonDelegate.Stub implements DrawableMarkup { - private static final String TAG = "GmsMapsPolygonImpl"; - - private final String id; - private final PolygonOptions options; - private final MarkupListener listener; - private boolean removed = false; - - public PolygonImpl(String id, PolygonOptions options, MarkupListener listener) { - this.id = id; - this.options = options; - this.listener = listener; - } - - @Override - public void remove() throws RemoteException { - listener.remove(this); - removed = true; - } - - @Override - public String getId() { - return id; - } - - @Override - public boolean onClick() { - return listener.onClick(this); - } - - @Override - public void onDragStart() { - listener.onDragStart(this); - } - - @Override - public void onDragStop() { - listener.onDragStop(this); - } - - @Override - public void onDragProgress() { - listener.onDragProgress(this); - } - - @Override - public void setPoints(List points) throws RemoteException { - options.getPoints().clear(); - options.getPoints().addAll(points); - listener.update(this); - } - - @Override - public List getPoints() throws RemoteException { - return options.getPoints(); - } - - @Override - public void setHoles(List holes) throws RemoteException { - options.getHoles().clear(); - options.getHoles().addAll(holes); - listener.update(this); - } - - @Override - public List getHoles() throws RemoteException { - return options.getHoles(); - } - - @Override - public void setStrokeWidth(float width) throws RemoteException { - options.strokeWidth(width); - listener.update(this); - } - - @Override - public float getStrokeWidth() { - return options.getStrokeWidth(); - } - - @Override - public void setStrokeColor(int color) throws RemoteException { - options.strokeColor(color); - listener.update(this); - } - - @Override - public int getStrokeColor() { - return options.getStrokeColor(); - } - - @Override - public void setFillColor(int color) throws RemoteException { - options.fillColor(color); - listener.update(this); - } - - @Override - public int getFillColor() { - return options.getFillColor(); - } - - @Override - public void setZIndex(float zIndex) throws RemoteException { - options.zIndex(zIndex); - listener.update(this); - } - - @Override - public float getZIndex() { - return options.getZIndex(); - } - - @Override - public Drawable getDrawable(Map map) { - if (!isVisible() || removed) return null; - List points = new ArrayList(); - for (LatLng point : options.getPoints()) { - points.add(GmsMapsTypeHelper.fromLatLng(point)); - } - if (points.size() < 3 || (points.size() == 3 && points.get(2).equals(points.get(0)))) { - // Need at least 3 distinguished points to draw a polygon - return null; - } - // TODO: holes - return new PolygonDrawable(points, Style.builder() - .fillAlpha(1) - .strokeColor(getStrokeColor()) - .strokeWidth(getStrokeWidth()) - .fillColor(getFillColor()) - .build()); - } - - @Override - public void setVisible(boolean visible) throws RemoteException { - options.visible(visible); - listener.update(this); - } - - @Override - public boolean isVisible() { - return options.isVisible(); - } - - @Override - public void setGeodesic(boolean geod) throws RemoteException { - options.geodesic(geod); - listener.update(this); - } - - @Override - public boolean isGeodesic() throws RemoteException { - return options.isGeodesic(); - } - - @Override - public boolean equalsRemote(IPolygonDelegate other) throws RemoteException { - return other != null && other.getId().equals(getId()); - } - - @Override - public int hashCodeRemote() throws RemoteException { - return id.hashCode(); - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/PolylineImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/PolylineImpl.java deleted file mode 100644 index b2ff4c2f..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/PolylineImpl.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.markup; - -import android.os.RemoteException; -import android.util.Log; - -import com.google.android.gms.maps.model.LatLng; -import com.google.android.gms.maps.model.PolylineOptions; -import com.google.android.gms.maps.model.internal.IPolylineDelegate; - -import org.microg.gms.maps.vtm.GmsMapsTypeHelper; -import org.oscim.core.GeoPoint; -import org.oscim.layers.vector.geometries.Drawable; -import org.oscim.layers.vector.geometries.LineDrawable; -import org.oscim.layers.vector.geometries.Style; -import org.oscim.map.Map; - -import java.util.ArrayList; -import java.util.List; - -public class PolylineImpl extends IPolylineDelegate.Stub implements DrawableMarkup { - private static final String TAG = "GmsMapsPolylineImpl"; - - private final String id; - private final PolylineOptions options; - private final MarkupListener listener; - private boolean removed = false; - - public PolylineImpl(String id, PolylineOptions options, MarkupListener listener) { - this.id = id; - this.options = options == null ? new PolylineOptions() : options; - this.listener = listener; - } - - @Override - public void remove() { - listener.remove(this); - removed = true; - } - - @Override - public String getId() { - return id; - } - - @Override - public boolean onClick() { - return listener.onClick(this); - } - - @Override - public void onDragStart() { - listener.onDragStart(this); - } - - @Override - public void onDragStop() { - listener.onDragStop(this); - } - - @Override - public void onDragProgress() { - listener.onDragProgress(this); - } - - @Override - public void setPoints(List points) { - options.getPoints().clear(); - options.getPoints().addAll(points); - listener.update(this); - } - - @Override - public List getPoints() { - return options.getPoints(); - } - - @Override - public void setWidth(float width) { - options.width(width); - listener.update(this); - } - - @Override - public float getWidth() { - return options.getWidth(); - } - - @Override - public void setColor(int color) { - this.options.color(color); - listener.update(this); - } - - @Override - public int getColor() { - return options.getColor(); - } - - @Override - public void setZIndex(float zIndex) { - options.zIndex(zIndex); - listener.update(this); - } - - @Override - public float getZIndex() { - return options.getZIndex(); - } - - @Override - public void setVisible(boolean visible) { - options.visible(visible); - listener.update(this); - } - - @Override - public boolean isVisible() { - return options.isVisible(); - } - - @Override - public void setGeodesic(boolean geod) { - options.geodesic(geod); - listener.update(this); - } - - @Override - public boolean isGeodesic() { - return options.isGeodesic(); - } - - @Override - public boolean equalsRemote(IPolylineDelegate other) throws RemoteException { - Log.d(TAG, "equalsRemote"); - return other != null && other.getId().equals(getId()); - } - - @Override - public int hashCodeRemote() { - Log.d(TAG, "hashcodeRemote"); - return id.hashCode(); - } - - @Override - public Drawable getDrawable(Map map) { - if (!isVisible() || removed) return null; - if (options.getPoints().size() < 2) { - // You hardly draw a line with less than two points - return null; - } - List points = new ArrayList(); - for (LatLng point : options.getPoints()) { - points.add(GmsMapsTypeHelper.fromLatLng(point)); - } - return new LineDrawable(points, Style.builder().strokeColor(getColor()).strokeWidth(getWidth()).build()); - } -} diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/TileOverlayImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/TileOverlayImpl.java deleted file mode 100644 index c13c0f6d..00000000 --- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/TileOverlayImpl.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.maps.vtm.markup; - -import com.google.android.gms.maps.model.internal.ITileOverlayDelegate; - -public class TileOverlayImpl extends ITileOverlayDelegate.Stub { -} diff --git a/play-services-maps-core-vtm/src/main/res/drawable/maps_default_marker.png b/play-services-maps-core-vtm/src/main/res/drawable/maps_default_marker.png deleted file mode 100644 index a963793a..00000000 Binary files a/play-services-maps-core-vtm/src/main/res/drawable/maps_default_marker.png and /dev/null differ diff --git a/play-services-maps-core-vtm/src/main/res/drawable/maps_default_window.9.png b/play-services-maps-core-vtm/src/main/res/drawable/maps_default_window.9.png deleted file mode 100644 index 57724d79..00000000 Binary files a/play-services-maps-core-vtm/src/main/res/drawable/maps_default_window.9.png and /dev/null differ diff --git a/play-services-maps-core-vtm/src/main/res/drawable/nop.png b/play-services-maps-core-vtm/src/main/res/drawable/nop.png deleted file mode 100644 index 0e676831..00000000 Binary files a/play-services-maps-core-vtm/src/main/res/drawable/nop.png and /dev/null differ diff --git a/play-services-maps-core-vtm/vtm-microg-theme/build.gradle b/play-services-maps-core-vtm/vtm-microg-theme/build.gradle deleted file mode 100644 index 3304c9a0..00000000 --- a/play-services-maps-core-vtm/vtm-microg-theme/build.gradle +++ /dev/null @@ -1,11 +0,0 @@ -apply plugin: 'java' -apply plugin: 'maven' - -dependencies { - compile "org.microg:vtm:0.9.1-mod" -} - -sourceSets { - main.java.srcDirs = ['src'] - main.resources.srcDirs = ['resources'] -} diff --git a/play-services-maps-core-vtm/vtm-microg-theme/resources/assets/styles/microg.xml b/play-services-maps-core-vtm/vtm-microg-theme/resources/assets/styles/microg.xml deleted file mode 100644 index 4fd884f6..00000000 --- a/play-services-maps-core-vtm/vtm-microg-theme/resources/assets/styles/microg.xml +++ /dev/null @@ -1,546 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/play-services-maps-core-vtm/vtm-microg-theme/resources/assets/symbols/dot_white.svg b/play-services-maps-core-vtm/vtm-microg-theme/resources/assets/symbols/dot_white.svg deleted file mode 100644 index af547354..00000000 --- a/play-services-maps-core-vtm/vtm-microg-theme/resources/assets/symbols/dot_white.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/play-services-maps-core-vtm/vtm-microg-theme/resources/assets/symbols/transit/train_station.svg b/play-services-maps-core-vtm/vtm-microg-theme/resources/assets/symbols/transit/train_station.svg deleted file mode 100644 index 3c54c3f6..00000000 --- a/play-services-maps-core-vtm/vtm-microg-theme/resources/assets/symbols/transit/train_station.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/play-services-maps-core-vtm/vtm-microg-theme/resources/assets/symbols/transit/train_station_small.svg b/play-services-maps-core-vtm/vtm-microg-theme/resources/assets/symbols/transit/train_station_small.svg deleted file mode 100644 index 95d239d5..00000000 --- a/play-services-maps-core-vtm/vtm-microg-theme/resources/assets/symbols/transit/train_station_small.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/play-services-maps-core-vtm/vtm-microg-theme/src/org/oscim/theme/MicrogThemes.java b/play-services-maps-core-vtm/vtm-microg-theme/src/org/oscim/theme/MicrogThemes.java deleted file mode 100644 index 6da23247..00000000 --- a/play-services-maps-core-vtm/vtm-microg-theme/src/org/oscim/theme/MicrogThemes.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.oscim.theme; - -import org.oscim.backend.AssetAdapter; - -import java.io.InputStream; - -public enum MicrogThemes implements ThemeFile { - - DEFAULT("styles/microg.xml"); - // TODO: night theme - - private final String mPath; - - MicrogThemes(String path) { - mPath = path; - } - - @Override - public XmlRenderThemeMenuCallback getMenuCallback() { - return null; - } - - @Override - public String getRelativePathPrefix() { - return ""; - } - - @Override - public InputStream getRenderThemeAsStream() { - return AssetAdapter.readFileAsStream(mPath); - } - - @Override - public void setMenuCallback(XmlRenderThemeMenuCallback menuCallback) { - } - - @Override - public boolean isMapsforgeTheme() { - return false; - } -} diff --git a/play-services-wearable-api/build.gradle b/play-services-wearable-api/build.gradle deleted file mode 100644 index 7d1eb81f..00000000 --- a/play-services-wearable-api/build.gradle +++ /dev/null @@ -1,37 +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. - */ - -apply plugin: 'com.android.library' - -android { - compileSdkVersion androidCompileSdk - buildToolsVersion "$androidBuildVersionTools" - - defaultConfig { - versionName version - minSdkVersion androidMinSdk - targetSdkVersion androidTargetSdk - } - - compileOptions { - sourceCompatibility = 1.8 - targetCompatibility = 1.8 - } -} - -dependencies { - api project(':play-services-basement') -} diff --git a/play-services-wearable-api/gradle.properties b/play-services-wearable-api/gradle.properties deleted file mode 100644 index c771353e..00000000 --- a/play-services-wearable-api/gradle.properties +++ /dev/null @@ -1,34 +0,0 @@ -# -# 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. -# - -POM_NAME=Play Services Internal Wearable API -POM_DESCRIPTION=Interfaces and objects for IPC between Play Services Library and Play Services Core - -POM_PACKAGING=aar - -POM_URL=https://github.com/microg/android_external_GmsApi - -POM_SCM_URL=https://github.com/microg/android_external_GmsApi -POM_SCM_CONNECTION=scm:git@github.com:microg/android_external_GmsApi.git -POM_SCM_DEV_CONNECTION=scm:git@github.com:microg/android_external_GmsApi.git - -POM_LICENCE_NAME=The Apache Software License, Version 2.0 -POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt -POM_LICENCE_DIST=repo - -POM_DEVELOPER_ID=mar-v-in -POM_DEVELOPER_NAME=Marvin W - diff --git a/play-services-wearable-api/src/main/AndroidManifest.xml b/play-services-wearable-api/src/main/AndroidManifest.xml deleted file mode 100644 index c0cf8869..00000000 --- a/play-services-wearable-api/src/main/AndroidManifest.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/Asset.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/Asset.aidl deleted file mode 100644 index 9cb94923..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/Asset.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable; - -parcelable Asset; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/ConnectionConfiguration.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/ConnectionConfiguration.aidl deleted file mode 100644 index 973008ad..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/ConnectionConfiguration.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable; - -parcelable ConnectionConfiguration; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/AddListenerRequest.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/AddListenerRequest.aidl deleted file mode 100644 index 21b8bba6..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/AddListenerRequest.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable AddListenerRequest; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/AddLocalCapabilityResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/AddLocalCapabilityResponse.aidl deleted file mode 100644 index 875512c6..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/AddLocalCapabilityResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable AddLocalCapabilityResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/AmsEntityUpdateParcelable.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/AmsEntityUpdateParcelable.aidl deleted file mode 100644 index 79d95d43..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/AmsEntityUpdateParcelable.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable AmsEntityUpdateParcelable; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/AncsNotificationParcelable.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/AncsNotificationParcelable.aidl deleted file mode 100644 index 8bdf1f78..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/AncsNotificationParcelable.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable AncsNotificationParcelable; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/CapabilityInfoParcelable.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/CapabilityInfoParcelable.aidl deleted file mode 100644 index 15742eed..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/CapabilityInfoParcelable.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable CapabilityInfoParcelable; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/ChannelEventParcelable.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/ChannelEventParcelable.aidl deleted file mode 100644 index 1f86443a..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/ChannelEventParcelable.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable ChannelEventParcelable; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/ChannelReceiveFileResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/ChannelReceiveFileResponse.aidl deleted file mode 100644 index 84d56ee9..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/ChannelReceiveFileResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable ChannelReceiveFileResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/ChannelSendFileResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/ChannelSendFileResponse.aidl deleted file mode 100644 index f1547ae0..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/ChannelSendFileResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable ChannelSendFileResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/CloseChannelResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/CloseChannelResponse.aidl deleted file mode 100644 index aceab124..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/CloseChannelResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable CloseChannelResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/DeleteDataItemsResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/DeleteDataItemsResponse.aidl deleted file mode 100644 index d5402cd6..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/DeleteDataItemsResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable DeleteDataItemsResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetAllCapabilitiesResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetAllCapabilitiesResponse.aidl deleted file mode 100644 index 610e5842..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetAllCapabilitiesResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable GetAllCapabilitiesResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetCapabilityResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetCapabilityResponse.aidl deleted file mode 100644 index 09e458fd..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetCapabilityResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable GetCapabilityResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetChannelInputStreamResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetChannelInputStreamResponse.aidl deleted file mode 100644 index 141a6558..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetChannelInputStreamResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable GetChannelInputStreamResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetChannelOutputStreamResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetChannelOutputStreamResponse.aidl deleted file mode 100644 index b08cdca1..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetChannelOutputStreamResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable GetChannelOutputStreamResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetCloudSyncOptInOutDoneResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetCloudSyncOptInOutDoneResponse.aidl deleted file mode 100644 index 3dfd71ba..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetCloudSyncOptInOutDoneResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable GetCloudSyncOptInOutDoneResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetCloudSyncOptInStatusResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetCloudSyncOptInStatusResponse.aidl deleted file mode 100644 index 20bfb741..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetCloudSyncOptInStatusResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable GetCloudSyncOptInStatusResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetCloudSyncSettingResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetCloudSyncSettingResponse.aidl deleted file mode 100644 index 3ac2cc1c..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetCloudSyncSettingResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable GetCloudSyncSettingResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetConfigResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetConfigResponse.aidl deleted file mode 100644 index 14f6b6ee..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetConfigResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable GetConfigResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetConfigsResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetConfigsResponse.aidl deleted file mode 100644 index 2cb7207a..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetConfigsResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable GetConfigsResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetConnectedNodesResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetConnectedNodesResponse.aidl deleted file mode 100644 index 9c0706e7..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetConnectedNodesResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable GetConnectedNodesResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetDataItemResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetDataItemResponse.aidl deleted file mode 100644 index b523f669..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetDataItemResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable GetDataItemResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetFdForAssetResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetFdForAssetResponse.aidl deleted file mode 100644 index 662ccfb6..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetFdForAssetResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable GetFdForAssetResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetLocalNodeResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetLocalNodeResponse.aidl deleted file mode 100644 index 90178068..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/GetLocalNodeResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable GetLocalNodeResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/IChannelStreamCallbacks.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/IChannelStreamCallbacks.aidl deleted file mode 100644 index 1f08e373..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/IChannelStreamCallbacks.aidl +++ /dev/null @@ -1,4 +0,0 @@ -package com.google.android.gms.wearable.internal; - -interface IChannelStreamCallbacks { -} diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/IWearableCallbacks.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/IWearableCallbacks.aidl deleted file mode 100644 index ffa91cb9..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/IWearableCallbacks.aidl +++ /dev/null @@ -1,65 +0,0 @@ -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.internal.AddLocalCapabilityResponse; -import com.google.android.gms.wearable.internal.ChannelReceiveFileResponse; -import com.google.android.gms.wearable.internal.ChannelSendFileResponse; -import com.google.android.gms.wearable.internal.CloseChannelResponse; -import com.google.android.gms.wearable.internal.DeleteDataItemsResponse; -import com.google.android.gms.wearable.internal.GetAllCapabilitiesResponse; -import com.google.android.gms.wearable.internal.GetCapabilityResponse; -import com.google.android.gms.wearable.internal.GetChannelInputStreamResponse; -import com.google.android.gms.wearable.internal.GetChannelOutputStreamResponse; -import com.google.android.gms.wearable.internal.GetCloudSyncOptInOutDoneResponse; -import com.google.android.gms.wearable.internal.GetCloudSyncOptInStatusResponse; -import com.google.android.gms.wearable.internal.GetCloudSyncSettingResponse; -import com.google.android.gms.wearable.internal.GetConfigResponse; -import com.google.android.gms.wearable.internal.GetConfigsResponse; -import com.google.android.gms.wearable.internal.GetConnectedNodesResponse; -import com.google.android.gms.wearable.internal.GetDataItemResponse; -import com.google.android.gms.wearable.internal.GetFdForAssetResponse; -import com.google.android.gms.wearable.internal.GetLocalNodeResponse; -import com.google.android.gms.wearable.internal.OpenChannelResponse; -import com.google.android.gms.wearable.internal.PutDataResponse; -import com.google.android.gms.wearable.internal.RemoveLocalCapabilityResponse; -import com.google.android.gms.wearable.internal.SendMessageResponse; -import com.google.android.gms.wearable.internal.StorageInfoResponse; - -interface IWearableCallbacks { - // Config - void onGetConfigResponse(in GetConfigResponse response) = 1; - void onGetConfigsResponse(in GetConfigsResponse response) = 12; - - // Cloud Sync - void onGetCloudSyncOptInOutDoneResponse(in GetCloudSyncOptInOutDoneResponse response) = 27; - void onGetCloudSyncSettingResponse(in GetCloudSyncSettingResponse response) = 28; - void onGetCloudSyncOptInStatusResponse(in GetCloudSyncOptInStatusResponse response) = 29; - - // Data - void onPutDataResponse(in PutDataResponse response) = 2; - void onGetDataItemResponse(in GetDataItemResponse response) = 3; - void onDataItemChanged(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; - - // Channels - void onOpenChannelResponse(in OpenChannelResponse response) = 13; - void onCloseChannelResponse(in CloseChannelResponse response) = 14; - void onGetChannelInputStreamResponse(in GetChannelInputStreamResponse response) = 16; - void onGetChannelOutputStreamResponse(in GetChannelOutputStreamResponse response) = 17; - void onChannelReceiveFileResponse(in ChannelReceiveFileResponse response) = 18; - void onChannelSendFileResponse(in ChannelSendFileResponse response) = 19; - - void onStatus(in Status status) = 10; - void onStorageInfoResponse(in StorageInfoResponse response) = 11; - - // Capabilities - void onGetCapabilityResponse(in GetCapabilityResponse response) = 21; - void onGetAllCapabilitiesResponse(in GetAllCapabilitiesResponse response) = 22; - void onAddLocalCapabilityResponse(in AddLocalCapabilityResponse response) = 25; - void onRemoveLocalCapabilityResponse(in RemoveLocalCapabilityResponse response) = 26; -} diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/IWearableListener.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/IWearableListener.aidl deleted file mode 100644 index 521f1166..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/IWearableListener.aidl +++ /dev/null @@ -1,21 +0,0 @@ -package com.google.android.gms.wearable.internal; - -import com.google.android.gms.common.data.DataHolder; -import com.google.android.gms.wearable.internal.AmsEntityUpdateParcelable; -import com.google.android.gms.wearable.internal.AncsNotificationParcelable; -import com.google.android.gms.wearable.internal.CapabilityInfoParcelable; -import com.google.android.gms.wearable.internal.ChannelEventParcelable; -import com.google.android.gms.wearable.internal.MessageEventParcelable; -import com.google.android.gms.wearable.internal.NodeParcelable; - -interface IWearableListener { - void onDataChanged(in DataHolder data) = 0; - void onMessageReceived(in MessageEventParcelable messageEvent) = 1; - void onPeerConnected(in NodeParcelable node) = 2; - void onPeerDisconnected(in NodeParcelable node) = 3; - void onConnectedNodes(in List nodes) = 4; - void onNotificationReceived(in AncsNotificationParcelable notification) = 5; - void onChannelEvent(in ChannelEventParcelable channelEvent) = 6; - void onConnectedCapabilityChanged(in CapabilityInfoParcelable capabilityInfo) = 7; - void onEntityUpdate(in AmsEntityUpdateParcelable update) = 8; -} diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/IWearableService.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/IWearableService.aidl deleted file mode 100644 index 193937e7..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/IWearableService.aidl +++ /dev/null @@ -1,82 +0,0 @@ -package com.google.android.gms.wearable.internal; - -import com.google.android.gms.wearable.Asset; -import com.google.android.gms.wearable.ConnectionConfiguration; -import com.google.android.gms.wearable.internal.AddListenerRequest; -import com.google.android.gms.wearable.internal.AncsNotificationParcelable; -import com.google.android.gms.wearable.internal.PutDataRequest; -import com.google.android.gms.wearable.internal.RemoveListenerRequest; -import com.google.android.gms.wearable.internal.IChannelStreamCallbacks; -import com.google.android.gms.wearable.internal.IWearableCallbacks; -import com.google.android.gms.wearable.internal.IWearableService; - -interface IWearableService { - // Configs - void putConfig(IWearableCallbacks callbacks, in ConnectionConfiguration config) = 19; - void deleteConfig(IWearableCallbacks callbacks, String name) = 20; - void getConfigs(IWearableCallbacks callbacks) = 21; - void enableConfig(IWearableCallbacks callbacks, String name) = 22; - void disableConfig(IWearableCallbacks callbacks, String name) = 23; - - // DataItems - void putData(IWearableCallbacks callbacks, in PutDataRequest request) = 5; - void getDataItem(IWearableCallbacks callbacks, in Uri uri) = 6; - void getDataItems(IWearableCallbacks callbacks) = 7; - void getDataItemsByUri(IWearableCallbacks callbacks, in Uri uri) = 8; - void getDataItemsByUriWithFilter(IWearableCallbacks callbacks, in Uri uri, int typeFilter) = 39; - void deleteDataItems(IWearableCallbacks callbacks, in Uri uri) = 10; - void deleteDataItemsWithFilter(IWearableCallbacks callbacks, in Uri uri, int typeFilter) = 40; - - void sendMessage(IWearableCallbacks callbacks, String targetNodeId, String path, in byte[] data) = 11; - void getFdForAsset(IWearableCallbacks callbacks, in Asset asset) = 12; - - void getLocalNode(IWearableCallbacks callbacks) = 13; - void getConnectedNodes(IWearableCallbacks callbacks) = 14; - - // Capabilties - void getConnectedCapability(IWearableCallbacks callbacks, String capability, int nodeFilter) = 41; - void getConnectedCapaibilties(IWearableCallbacks callbacks, int nodeFilter) = 42; - void addLocalCapability(IWearableCallbacks callbacks, String capability) = 45; - void removeLocalCapability(IWearableCallbacks callbacks, String capability) = 46; - - void addListener(IWearableCallbacks callbacks, in AddListenerRequest request) = 15; - void removeListener(IWearableCallbacks callbacks, in RemoveListenerRequest request) = 16; - - void getStorageInformation(IWearableCallbacks callbacks) = 17; - void clearStorage(IWearableCallbacks callbacks) = 18; - - void endCall(IWearableCallbacks callbacks) = 24; - void acceptRingingCall(IWearableCallbacks callbacks) = 25; - void silenceRinger(IWearableCallbacks callbacks) = 29; - - // Apple Notification Center Service - void injectAncsNotificationForTesting(IWearableCallbacks callbacks, in AncsNotificationParcelable notification) = 26; - void doAncsPositiveAction(IWearableCallbacks callbacks, int i) = 27; - void doAncsNegativeAction(IWearableCallbacks callbacks, int i) = 28; - - // Channels - void openChannel(IWearableCallbacks callbacks, String s1, String s2) = 30; - void closeChannel(IWearableCallbacks callbacks, String s) = 31; - void closeChannelWithError(IWearableCallbacks callbacks, String s, int errorCode) = 32; - void getChannelInputStream(IWearableCallbacks callbacks, IChannelStreamCallbacks channelCallbacks, String s) = 33; - void getChannelOutputStream(IWearableCallbacks callbacks, IChannelStreamCallbacks channelCallbacks, String s) = 34; - void writeChannelInputToFd(IWearableCallbacks callbacks, String s, in ParcelFileDescriptor fd) = 37; - void readChannelOutputFromFd(IWearableCallbacks callbacks, String s, in ParcelFileDescriptor fd, long l1, long l2) = 38; - - void syncWifiCredentials(IWearableCallbacks callbacks) = 36; - - // Cloud Sync - void optInCloudSync(IWearableCallbacks callbacks, boolean enable) = 47; - void getCloudSyncOptInDone(IWearableCallbacks callbacks) = 48; // deprecated - void setCloudSyncSetting(IWearableCallbacks callbacks, boolean enable) = 49; - void getCloudSyncSetting(IWearableCallbacks callbacks) = 50; - void getCloudSyncOptInStatus(IWearableCallbacks callbacks) = 51; - - void sendRemoteCommand(IWearableCallbacks callbacks, byte b) = 52; - - // deprecated Connection - void putConnection(IWearableCallbacks callbacks, in ConnectionConfiguration config) = 1; - void getConnection(IWearableCallbacks callbacks) = 2; - void enableConnection(IWearableCallbacks callbacks) = 3; - void disableConnection(IWearableCallbacks callbacks) = 4; -} diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/MessageEventParcelable.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/MessageEventParcelable.aidl deleted file mode 100644 index a3968f06..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/MessageEventParcelable.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable MessageEventParcelable; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/NodeParcelable.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/NodeParcelable.aidl deleted file mode 100644 index f10069df..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/NodeParcelable.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable NodeParcelable; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/OpenChannelResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/OpenChannelResponse.aidl deleted file mode 100644 index 4bc17769..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/OpenChannelResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable OpenChannelResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/PutDataRequest.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/PutDataRequest.aidl deleted file mode 100644 index 7fe2a19b..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/PutDataRequest.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable PutDataRequest; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/PutDataResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/PutDataResponse.aidl deleted file mode 100644 index 6f6f23e0..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/PutDataResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable PutDataResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/RemoveListenerRequest.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/RemoveListenerRequest.aidl deleted file mode 100644 index bf28d18f..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/RemoveListenerRequest.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable RemoveListenerRequest; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/RemoveLocalCapabilityResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/RemoveLocalCapabilityResponse.aidl deleted file mode 100644 index dc358804..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/RemoveLocalCapabilityResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable RemoveLocalCapabilityResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/SendMessageResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/SendMessageResponse.aidl deleted file mode 100644 index 3c83498f..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/SendMessageResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable SendMessageResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/StorageInfoResponse.aidl b/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/StorageInfoResponse.aidl deleted file mode 100644 index ea1ab215..00000000 --- a/play-services-wearable-api/src/main/aidl/com/google/android/gms/wearable/internal/StorageInfoResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.google.android.gms.wearable.internal; - -parcelable StorageInfoResponse; \ No newline at end of file diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/AmsEntityUpdate.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/AmsEntityUpdate.java deleted file mode 100644 index 768f4d52..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/AmsEntityUpdate.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -public interface AmsEntityUpdate { -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/AncsNotification.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/AncsNotification.java deleted file mode 100644 index eec6647c..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/AncsNotification.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -public interface AncsNotification { -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/Asset.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/Asset.java deleted file mode 100644 index c9e22edf..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/Asset.java +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import android.net.Uri; -import android.os.ParcelFileDescriptor; - -import com.google.android.gms.wearable.internal.PutDataRequest; - -import org.microg.gms.common.PublicApi; -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -import java.util.Arrays; - -/** - * An asset is a binary blob shared between data items that is replicated across the wearable - * network on demand. - *

- * It may represent an asset not yet added with the Android Wear network. DataItemAssets - * are representations of an asset after it has been added to the network through a - * {@link PutDataRequest}. - */ -@PublicApi -public class Asset extends AutoSafeParcelable { - - @SafeParceled(1) - private int versionCode = 1; - @SafeParceled(2) - @PublicApi(exclude = true) - public byte[] data; - @SafeParceled(3) - private String digest; - @SafeParceled(4) - private ParcelFileDescriptor fd; - @SafeParceled(5) - private Uri uri; - - private Asset() { - } - - private Asset(byte[] data, String digest, ParcelFileDescriptor fd, Uri uri) { - this.data = data; - this.digest = digest; - this.fd = fd; - this.uri = uri; - } - - /** - * Creates an Asset using a byte array. - */ - public static Asset createFromBytes(byte[] assetData) { - return null; - } - - /** - * Creates an Asset using a file descriptor. The FD should be closed after being successfully - * sent in a putDataItem request. - */ - public static Asset createFromFd(ParcelFileDescriptor fd) { - if (fd == null) { - throw new IllegalArgumentException("Asset fd cannot be null"); - } - return new Asset(null, null, fd, null); - } - - /** - * Create an Asset using an existing Asset's digest. - */ - public static Asset createFromRef(String digest) { - if (digest == null) { - throw new IllegalArgumentException("Asset digest cannot be null"); - } - return new Asset(null, digest, null, null); - } - - /** - * Creates an Asset using a content URI. Google Play services must have permission to read this - * Uri. - */ - public static Asset createFromUri(Uri uri) { - return null; - } - - /** - * @return the digest associated with the asset data. A digest is a content identifier used to - * identify the asset across devices. - */ - public String getDigest() { - return digest; - } - - /** - * @return the file descriptor referencing the asset. - */ - public ParcelFileDescriptor getFd() { - return fd; - } - - /** - * @return the uri referencing the asset data. - */ - public Uri getUri() { - return uri; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Asset asset = (Asset) o; - - if (!Arrays.equals(data, asset.data)) return false; - if (digest != null ? !digest.equals(asset.digest) : asset.digest != null) return false; - if (fd != null ? !fd.equals(asset.fd) : asset.fd != null) return false; - return !(uri != null ? !uri.equals(asset.uri) : asset.uri != null); - - } - - @Override - public int hashCode() { - return Arrays.hashCode(new Object[]{data, digest, fd, uri}); - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("Asset[@") - .append(Integer.toHexString(hashCode())) - .append(", ") - .append(digest != null ? digest : "nodigest"); - if (this.data != null) sb.append(", size=").append(data.length); - if (this.fd != null) sb.append(", fd=").append(fd); - if (this.uri != null) sb.append(", uri=").append(uri); - return sb.append("]").toString(); - } - - public static final Creator CREATOR = new AutoCreator(Asset.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/CapabilityInfo.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/CapabilityInfo.java deleted file mode 100644 index 6c9dd1ab..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/CapabilityInfo.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import java.util.Set; - -/** - * Information about a Capability on the network and where it is available. - */ -public interface CapabilityInfo { - /** - * Returns the name of the capability. - */ - String getName(); - - /** - * Returns the set of nodes for the capability. Disconnected nodes may or may not be included in the set. - */ - Set getNodes(); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/ConnectionConfiguration.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/ConnectionConfiguration.java deleted file mode 100644 index 214481da..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/ConnectionConfiguration.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -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; - } - - @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-wearable-api/src/main/java/com/google/android/gms/wearable/DataItem.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/DataItem.java deleted file mode 100644 index 56a30823..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/DataItem.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import android.net.Uri; - -import com.google.android.gms.common.data.Freezable; - -import org.microg.gms.common.PublicApi; - -import java.util.Map; - -/** - * The base object of data stored in the Android Wear network. {@link DataItem} are replicated - * across all devices in the network. It contains a small blob of data and associated assets. - *

- * A {@link DataItem} is identified by its Uri, which contains its creator and a path. - */ -@PublicApi -public interface DataItem extends Freezable { - /** - * A map of assets associated with this data item. - */ - Map getAssets(); - - /** - * An array of data stored at the specified {@link Uri}. - */ - byte[] getData(); - - /** - * Returns the DataItem's Uri. {@link Uri#getHost()} returns the id of the node that created it. - */ - Uri getUri(); - - /** - * Sets the data in a data item. - *

- * The current maximum data item size limit is approximately 100k. Data items should generally be much smaller than this limit. - */ - DataItem setData(byte[] data); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/DataItemAsset.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/DataItemAsset.java deleted file mode 100644 index c4392155..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/DataItemAsset.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import com.google.android.gms.common.data.Freezable; - -/** - * A reference to an asset stored in a data item. Used to fetch file descriptors using - * DataApi#getFdForAsset(GoogleApiClient, DataItemAsset). - */ -public interface DataItemAsset extends Freezable { - /** - * @return the identifier used to address this asset in the context of an existing - * {@link DataItem}. - */ - String getDataItemKey(); - - /** - * @return the Android Wear-wide unique identifier for a particular asset. - */ - String getId(); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/MessageEvent.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/MessageEvent.java deleted file mode 100644 index 17f44c13..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/MessageEvent.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import org.microg.gms.common.PublicApi; - -@PublicApi -public interface MessageEvent { - /** - * @return the data passed by the message. - */ - byte[] getData(); - - /** - * @return the path the message is being delivered to - */ - String getPath(); - - /** - * @return the request id of the message, generated by the sender - */ - int getRequestId(); - - /** - * @return the node ID of the sender. - */ - String getSourceNodeId(); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/Node.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/Node.java deleted file mode 100644 index 6cef4ec0..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/Node.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import org.microg.gms.common.PublicApi; - -/** - * Information about a particular node in the Android Wear network. - */ -@PublicApi -public interface Node { - /** - * Returns a human readable description of the node. Sometimes generated from the Bluetooth - * device name - */ - String getDisplayName(); - - /** - * Returns an opaque string that represents a node in the Android Wear network. - */ - String getId(); - - /** - * Indicates that this node can be considered geographically nearby the local node. - */ - boolean isNearby(); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/WearableStatusCodes.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/WearableStatusCodes.java deleted file mode 100644 index dc3bc64e..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/WearableStatusCodes.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import com.google.android.gms.common.api.CommonStatusCodes; - -import org.microg.gms.common.PublicApi; - -/** - * Error codes for wearable API failures. These values may be returned by APIs to indicate the - * success or failure of a request. - */ -@PublicApi -public class WearableStatusCodes extends CommonStatusCodes { - /** - * Indicates that the targeted node is not accessible in the wearable network. - */ - public static final int TARGET_NODE_NOT_CONNECTED = 4000; - /** - * Indicates that the specified listener is already registered. - */ - public static final int DUPLICATE_LISTENER = 4001; - /** - * Indicates that the specified listener is not recognized. - */ - public static final int UNKNOWN_LISTENER = 4002; - /** - * Indicates that the data item was too large to set. - */ - public static final int DATA_ITEM_TOO_LARGE = 4003; - /** - * Indicates that the targeted node is not a valid node in the wearable network. - */ - public static final int INVALID_TARGET_NODE = 4004; - /** - * Indicates that the requested asset is unavailable. - */ - public static final int ASSET_UNAVAILABLE = 4005; - /** - * Indicates that the specified capability already exists. - */ - public static final int DUPLICATE_CAPABILITY = 4006; - /** - * Indicates that the specified capability is not recognized. - */ - public static final int UNKNOWN_CAPABILITY = 4007; - /** - * Indicates that the WiFi credential sync no credential fetched. - */ - public static final int WIFI_CREDENTIAL_SYNC_NO_CREDENTIAL_FETCHED = 4008; -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/AddListenerRequest.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/AddListenerRequest.java deleted file mode 100644 index 62dcf75e..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/AddListenerRequest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -import android.content.IntentFilter; - -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; - @SafeParceled(4) - public final String channelTokenString; - - private AddListenerRequest() { - listener = null; - intentFilters = null; - channelTokenString = null; - } - - public AddListenerRequest(IWearableListener listener, IntentFilter[] intentFilters, String channelTokenString) { - this.listener = listener; - this.intentFilters = intentFilters; - this.channelTokenString = channelTokenString; - } - - public static final Creator CREATOR = new AutoCreator(AddListenerRequest.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/AddLocalCapabilityResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/AddLocalCapabilityResponse.java deleted file mode 100644 index 8446da2c..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/AddLocalCapabilityResponse.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2019 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.wearable.internal; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class AddLocalCapabilityResponse extends AutoSafeParcelable { - @SafeParceled(1) - private int versionCode = 1; - @SafeParceled(2) - private int status = 0; - - private AddLocalCapabilityResponse() { - } - - public AddLocalCapabilityResponse(int status) { - this.status = status; - } - - public static final Creator CREATOR = new AutoCreator(AddLocalCapabilityResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/AmsEntityUpdateParcelable.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/AmsEntityUpdateParcelable.java deleted file mode 100644 index f496ce59..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/AmsEntityUpdateParcelable.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -import com.google.android.gms.wearable.AmsEntityUpdate; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class AmsEntityUpdateParcelable extends AutoSafeParcelable implements AmsEntityUpdate { - public static final Creator CREATOR = new AutoCreator(AmsEntityUpdateParcelable.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/AncsNotificationParcelable.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/AncsNotificationParcelable.java deleted file mode 100644 index 652e1d13..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/AncsNotificationParcelable.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -import com.google.android.gms.wearable.AncsNotification; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class AncsNotificationParcelable extends AutoSafeParcelable implements AncsNotification { - public static final Creator CREATOR = new AutoCreator(AncsNotificationParcelable.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/CapabilityInfoParcelable.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/CapabilityInfoParcelable.java deleted file mode 100644 index 49daaba5..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/CapabilityInfoParcelable.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -import com.google.android.gms.wearable.CapabilityInfo; -import com.google.android.gms.wearable.Node; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -public class CapabilityInfoParcelable extends AutoSafeParcelable implements CapabilityInfo { - @SafeParceled(1) - private int versionCode = 1; - - @SafeParceled(2) - private String name; - - @SafeParceled(value = 3, subClass = NodeParcelable.class) - private List nodeParcelables; - - private Set nodes; - private Object lock = new Object(); - - private CapabilityInfoParcelable() { - } - - public CapabilityInfoParcelable(String name, List nodeParcelables) { - this.name = name; - this.nodeParcelables = nodeParcelables; - } - - @Override - public String getName() { - return name; - } - - @Override - public synchronized Set getNodes() { - if (nodes == null) { - nodes = new HashSet(nodeParcelables); - } - return nodes; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - if (other == null || getClass() != other.getClass()) return false; - - CapabilityInfoParcelable that = (CapabilityInfoParcelable) other; - - if (versionCode != that.versionCode) return false; - if (name != null ? !name.equals(that.name) : that.name != null) return false; - return nodeParcelables != null ? nodeParcelables.equals(that.nodeParcelables) : that.nodeParcelables == null; - } - - @Override - public int hashCode() { - int result = versionCode; - result = 31 * result + (name != null ? name.hashCode() : 0); - result = 31 * result + (nodeParcelables != null ? nodeParcelables.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "CapabilityInfo{" + name + ", " + nodeParcelables + "}"; - } - - public static final Creator CREATOR = new AutoCreator(CapabilityInfoParcelable.class); - -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/ChannelEventParcelable.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/ChannelEventParcelable.java deleted file mode 100644 index 39dedeeb..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/ChannelEventParcelable.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class ChannelEventParcelable extends AutoSafeParcelable { - - @SafeParceled(1) - private int versionCode = 1; - @SafeParceled(2) - public ChannelParcelable channel; - @SafeParceled(3) - public int eventType; - @SafeParceled(4) - public int closeReason; - @SafeParceled(5) - public int appSpecificErrorCode; - - public static final Creator CREATOR = new AutoCreator(ChannelEventParcelable.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/ChannelParcelable.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/ChannelParcelable.java deleted file mode 100644 index 79ffb070..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/ChannelParcelable.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class ChannelParcelable extends AutoSafeParcelable { - @SafeParceled(1) - private int versionCode = 1; - @SafeParceled(2) - public String token; - @SafeParceled(3) - public String nodeId; - @SafeParceled(4) - public String path; - - private ChannelParcelable() { - } - - public ChannelParcelable(String token, String nodeId, String path) { - this.token = token; - this.nodeId = nodeId; - this.path = path; - } - - public static final Creator CREATOR = new AutoCreator(ChannelParcelable.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/ChannelReceiveFileResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/ChannelReceiveFileResponse.java deleted file mode 100644 index 9a6a05fe..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/ChannelReceiveFileResponse.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2019 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.wearable.internal; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class ChannelReceiveFileResponse extends AutoSafeParcelable { - @SafeParceled(1) - private int versionCode = 1; - public static final Creator CREATOR = new AutoCreator(ChannelReceiveFileResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/ChannelSendFileResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/ChannelSendFileResponse.java deleted file mode 100644 index 09a2cb19..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/ChannelSendFileResponse.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2019 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.wearable.internal; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class ChannelSendFileResponse extends AutoSafeParcelable { - @SafeParceled(1) - private int versionCode = 1; - public static final Creator CREATOR = new AutoCreator(ChannelSendFileResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/CloseChannelResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/CloseChannelResponse.java deleted file mode 100644 index 3520593b..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/CloseChannelResponse.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2019 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.wearable.internal; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class CloseChannelResponse extends AutoSafeParcelable { - @SafeParceled(1) - private int versionCode = 1; - public static final Creator CREATOR = new AutoCreator(CloseChannelResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/DataItemAssetParcelable.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/DataItemAssetParcelable.java deleted file mode 100644 index 76957360..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/DataItemAssetParcelable.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -import com.google.android.gms.wearable.DataItemAsset; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class DataItemAssetParcelable extends AutoSafeParcelable implements DataItemAsset { - - @SafeParceled(1) - private int versionCode = 1; - @SafeParceled(2) - private String id; - @SafeParceled(3) - private String key; - - private DataItemAssetParcelable() { - } - - public DataItemAssetParcelable(String id, String key) { - this.id = id; - this.key = key; - } - - @Override - public String getDataItemKey() { - return key; - } - - @Override - public String getId() { - return id; - } - - @Override - public DataItemAsset freeze() { - return this; - } - - @Override - public boolean isDataValid() { - return true; - } - - public static final Creator CREATOR = new AutoCreator(DataItemAssetParcelable.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/DataItemParcelable.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/DataItemParcelable.java deleted file mode 100644 index 837b5fa9..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/DataItemParcelable.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -import android.net.Uri; -import android.os.Bundle; - -import com.google.android.gms.wearable.DataItem; -import com.google.android.gms.wearable.DataItemAsset; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -import java.util.HashMap; -import java.util.Map; - -public class DataItemParcelable extends AutoSafeParcelable implements DataItem { - @SafeParceled(1) - private int versionCode = 1; - @SafeParceled(2) - private Uri uri; - @SafeParceled(4) - private Bundle assets = new Bundle(); - @SafeParceled(5) - public byte[] data; - - private DataItemParcelable() { - } - - public DataItemParcelable(Uri uri) { - this(uri, new HashMap()); - } - - public DataItemParcelable(Uri uri, Map assets) { - this.uri = uri; - for (String key : assets.keySet()) { - this.assets.putParcelable(key, assets.get(key)); - } - data = null; - } - - public Map getAssets() { - Map assets = new HashMap(); - this.assets.setClassLoader(DataItemAssetParcelable.class.getClassLoader()); - for (String key : this.assets.keySet()) { - assets.put(key, (DataItemAssetParcelable) this.assets.getParcelable(key)); - } - return assets; - } - - @Override - public byte[] getData() { - return data; - } - - @Override - public Uri getUri() { - return uri; - } - - @Override - public DataItem setData(byte[] data) { - this.data = data; - return this; - } - - @Override - public DataItem freeze() { - return this; - } - - @Override - public boolean isDataValid() { - return true; - } - - public static final Creator CREATOR = new AutoCreator(DataItemParcelable.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/DeleteDataItemsResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/DeleteDataItemsResponse.java deleted file mode 100644 index 01985c2d..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/DeleteDataItemsResponse.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class DeleteDataItemsResponse extends AutoSafeParcelable { - - @SafeParceled(1) - private int versionCode = 1; - @SafeParceled(2) - private int status; - @SafeParceled(3) - private int count; - - private DeleteDataItemsResponse() { - } - - public DeleteDataItemsResponse(int status, int count) { - this.status = status; - this.count = count; - } - - public static final Creator CREATOR = new AutoCreator(DeleteDataItemsResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetAllCapabilitiesResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetAllCapabilitiesResponse.java deleted file mode 100644 index a807ec29..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetAllCapabilitiesResponse.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2019 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.wearable.internal; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class GetAllCapabilitiesResponse extends AutoSafeParcelable { - @SafeParceled(1) - private int versionCode = 1; - public static final Creator CREATOR = new AutoCreator(GetAllCapabilitiesResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetCapabilityResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetCapabilityResponse.java deleted file mode 100644 index be7a5565..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetCapabilityResponse.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 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.wearable.internal; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class GetCapabilityResponse extends AutoSafeParcelable { - @SafeParceled(1) - private int versionCode = 1; - @SafeParceled(2) - private int status; - @SafeParceled(3) - private CapabilityInfoParcelable capabilityInfo; - - private GetCapabilityResponse() { - } - - public GetCapabilityResponse(int status, CapabilityInfoParcelable capabilityInfo) { - this.status = status; - this.capabilityInfo = capabilityInfo; - } - - public static final Creator CREATOR = new AutoCreator(GetCapabilityResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetChannelInputStreamResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetChannelInputStreamResponse.java deleted file mode 100644 index b5460a43..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetChannelInputStreamResponse.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2019 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.wearable.internal; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class GetChannelInputStreamResponse extends AutoSafeParcelable { - @SafeParceled(1) - private int versionCode = 1; - public static final Creator CREATOR = new AutoCreator(GetChannelInputStreamResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetChannelOutputStreamResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetChannelOutputStreamResponse.java deleted file mode 100644 index 71e024e2..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetChannelOutputStreamResponse.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2019 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.wearable.internal; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class GetChannelOutputStreamResponse extends AutoSafeParcelable { - @SafeParceled(1) - private int versionCode = 1; - public static final Creator CREATOR = new AutoCreator(GetChannelOutputStreamResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetCloudSyncOptInOutDoneResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetCloudSyncOptInOutDoneResponse.java deleted file mode 100644 index 1c3c63ec..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetCloudSyncOptInOutDoneResponse.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2019 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.wearable.internal; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class GetCloudSyncOptInOutDoneResponse extends AutoSafeParcelable { - @SafeParceled(1) - private int versionCode = 1; - public static final Creator CREATOR = new AutoCreator(GetCloudSyncOptInOutDoneResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetCloudSyncOptInStatusResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetCloudSyncOptInStatusResponse.java deleted file mode 100644 index da213312..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetCloudSyncOptInStatusResponse.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2019 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.wearable.internal; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class GetCloudSyncOptInStatusResponse extends AutoSafeParcelable { - @SafeParceled(1) - private int versionCode = 1; - public static final Creator CREATOR = new AutoCreator(GetCloudSyncOptInStatusResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetCloudSyncSettingResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetCloudSyncSettingResponse.java deleted file mode 100644 index 97fd9cb7..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetCloudSyncSettingResponse.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class GetCloudSyncSettingResponse extends AutoSafeParcelable { - @SafeParceled(1) - private int versionCode = 1; - @SafeParceled(2) - public int statusCode; - @SafeParceled(3) - public boolean cloudSyncEnabled; - - private GetCloudSyncSettingResponse() {} - - public GetCloudSyncSettingResponse(int statusCode, boolean cloudSyncEnabled) { - this.statusCode = statusCode; - this.cloudSyncEnabled = cloudSyncEnabled; - } - - public static final Creator CREATOR = new AutoCreator(GetCloudSyncSettingResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetConfigResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetConfigResponse.java deleted file mode 100644 index bb637358..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetConfigResponse.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -import com.google.android.gms.wearable.ConnectionConfiguration; - -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 CREATOR = new AutoCreator(GetConfigResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetConfigsResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetConfigsResponse.java deleted file mode 100644 index 5c0cc2cf..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetConfigsResponse.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -import com.google.android.gms.wearable.ConnectionConfiguration; - -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 CREATOR = new AutoCreator(GetConfigsResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetConnectedNodesResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetConnectedNodesResponse.java deleted file mode 100644 index b43c2df1..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetConnectedNodesResponse.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -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(value = 3, subClass = NodeParcelable.class) - public final List nodes; - - private GetConnectedNodesResponse() { - statusCode = 0; - nodes = null; - } - - public GetConnectedNodesResponse(int statusCode, List nodes) { - this.statusCode = statusCode; - this.nodes = nodes; - } - - public static final Creator CREATOR = new AutoCreator(GetConnectedNodesResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetDataItemResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetDataItemResponse.java deleted file mode 100644 index aeec53a1..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetDataItemResponse.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -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 CREATOR = new AutoCreator(GetDataItemResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetFdForAssetResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetFdForAssetResponse.java deleted file mode 100644 index 7c34414d..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetFdForAssetResponse.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -import android.os.ParcelFileDescriptor; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class GetFdForAssetResponse extends AutoSafeParcelable { - @SafeParceled(1) - private int versionCode = 1; - - @SafeParceled(2) - public int statusCode; - - @SafeParceled(3) - public ParcelFileDescriptor pfd; - - private GetFdForAssetResponse() { - } - - public GetFdForAssetResponse(int statusCode, ParcelFileDescriptor pfd) { - this.statusCode = statusCode; - this.pfd = pfd; - } - - public static final Creator CREATOR = new AutoCreator(GetFdForAssetResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetLocalNodeResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetLocalNodeResponse.java deleted file mode 100644 index 1acbaaf0..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/GetLocalNodeResponse.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -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 CREATOR = new AutoCreator(GetLocalNodeResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/MessageEventParcelable.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/MessageEventParcelable.java deleted file mode 100644 index 1eb95c32..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/MessageEventParcelable.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -import com.google.android.gms.wearable.MessageEvent; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class MessageEventParcelable extends AutoSafeParcelable implements MessageEvent { - - @SafeParceled(1) - private int versionCode = 1; - @SafeParceled(2) - public int requestId; - @SafeParceled(3) - public String path; - @SafeParceled(4) - public byte[] data; - @SafeParceled(5) - public String sourceNodeId; - - @Override - public byte[] getData() { - return data; - } - - @Override - public String getPath() { - return path; - } - - @Override - public int getRequestId() { - return requestId; - } - - @Override - public String getSourceNodeId() { - return sourceNodeId; - } - - @Override - public String toString() { - return "MessageEventParcelable{" + - "requestId=" + requestId + - ", path='" + path + '\'' + - ", dataSize=" + (data != null ? data.length : -1) + - ", sourceNodeId='" + sourceNodeId + '\'' + - '}'; - } - - public static final Creator CREATOR = new AutoCreator(MessageEventParcelable.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/NodeParcelable.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/NodeParcelable.java deleted file mode 100644 index 1c8af18b..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/NodeParcelable.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -import com.google.android.gms.wearable.Node; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -/** - * Parcelable implementation of the {@link com.google.android.gms.wearable.Node} interface. - */ -public class NodeParcelable extends AutoSafeParcelable implements Node { - @SafeParceled(1) - private int versionCode = 1; - @SafeParceled(2) - private final String nodeId; - @SafeParceled(3) - private final String displayName; - @SafeParceled(4) - private final int hops; - @SafeParceled(5) - private final boolean isNearby; - - private NodeParcelable() { - nodeId = displayName = null; - hops = 0; - isNearby = false; - } - - public NodeParcelable(String nodeId, String displayName, int hops, boolean isNearby) { - this.nodeId = nodeId; - this.displayName = displayName; - this.hops = hops; - this.isNearby = isNearby; - } - - public NodeParcelable(String nodeId, String displayName) { - this(nodeId, displayName, 0, false); - } - - public NodeParcelable(Node node) { - this(node.getId(), node.getDisplayName(), 0, node.isNearby()); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - NodeParcelable that = (NodeParcelable) o; - - if (!nodeId.equals(that.nodeId)) return false; - if (!displayName.equals(that.displayName)) return false; - - return true; - } - - @Override - public String getDisplayName() { - return displayName; - } - - @Override - public String getId() { - return nodeId; - } - - @Override - public boolean isNearby() { - return isNearby; - } - - @Override - public int hashCode() { - return nodeId.hashCode(); - } - - @Override - public String toString() { - return "NodeParcelable{" + displayName + ", id=" + displayName + ", hops=" + hops + ", isNearby=" + isNearby + "}"; - } - - public static final Creator CREATOR = new AutoCreator(NodeParcelable.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/OpenChannelResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/OpenChannelResponse.java deleted file mode 100644 index fcd97a22..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/OpenChannelResponse.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2019 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.wearable.internal; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class OpenChannelResponse extends AutoSafeParcelable { - @SafeParceled(1) - private int versionCode = 1; - public static final Creator CREATOR = new AutoCreator(OpenChannelResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/PutDataRequest.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/PutDataRequest.java deleted file mode 100644 index ec9d6b2f..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/PutDataRequest.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -import android.net.Uri; -import android.os.Bundle; -import android.text.TextUtils; -import android.util.Base64; - -import com.google.android.gms.wearable.Asset; -import com.google.android.gms.wearable.DataItem; - -import org.microg.gms.common.PublicApi; -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -import java.util.HashMap; -import java.util.Map; - -/** - * {@link PutDataRequest} is used to create new data items in the Android Wear network. - */ -@PublicApi -public class PutDataRequest extends AutoSafeParcelable { - public static final String WEAR_URI_SCHEME = "wear"; - private static final int DEFAULT_SYNC_DEADLINE = 30 * 60 * 1000; - - @SafeParceled(1) - private int versionCode = 1; - @SafeParceled(2) - final Uri uri; - @SafeParceled(4) - private final Bundle assets; - @SafeParceled(5) - byte[] data; - @SafeParceled(6) - long syncDeadline = DEFAULT_SYNC_DEADLINE; - - 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) { - 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) { - PutDataRequest dataRequest = new PutDataRequest(source.getUri()); - dataRequest.data = source.getData(); - // TODO: assets - return dataRequest; - } - - public static PutDataRequest createWithAutoAppendedId(String pathPrefix) { - return new PutDataRequest(null); - } - - public Asset getAsset(String key) { - return assets.getParcelable(key); - } - - public Map getAssets() { - Map map = new HashMap(); - assets.setClassLoader(DataItemAssetParcelable.class.getClassLoader()); - for (String key : assets.keySet()) { - map.put(key, (Asset) assets.getParcelable(key)); - } - return map; - } - - public byte[] getData() { - return data; - } - - public Uri getUri() { - return uri; - } - - public boolean hasAsset(String key) { - return assets.containsKey(key); - } - - public PutDataRequest putAsset(String key, Asset value) { - assets.putParcelable(key, value); - return this; - } - - public PutDataRequest removeAsset(String key) { - assets.remove(key); - return this; - } - - public PutDataRequest setData(byte[] data) { - this.data = data; - return this; - } - - @Override - public String toString() { - return toString(false); - } - - public String toString(boolean verbose) { - StringBuilder sb = new StringBuilder(); - sb.append("PutDataRequest[uri=").append(uri) - .append(", data=").append(data == null ? "null" : Base64.encodeToString(data, Base64.NO_WRAP)) - .append(", numAssets=").append(getAssets().size()); - if (verbose && !getAssets().isEmpty()) { - sb.append(", assets=["); - for (String key : getAssets().keySet()) { - sb.append(key).append('=').append(getAsset(key)).append(", "); - } - sb.delete(sb.length() - 2, sb.length()).append(']'); - } - sb.append("]"); - return sb.toString(); - } - - public static final Creator CREATOR = new AutoCreator(PutDataRequest.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/PutDataResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/PutDataResponse.java deleted file mode 100644 index aa7d12d8..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/PutDataResponse.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -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 CREATOR = new AutoCreator(PutDataResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/RemoveListenerRequest.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/RemoveListenerRequest.java deleted file mode 100644 index c28c74b0..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/RemoveListenerRequest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -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 CREATOR = new AutoCreator(RemoveListenerRequest.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/RemoveLocalCapabilityResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/RemoveLocalCapabilityResponse.java deleted file mode 100644 index 516ebee5..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/RemoveLocalCapabilityResponse.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2019 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.wearable.internal; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class RemoveLocalCapabilityResponse extends AutoSafeParcelable { - @SafeParceled(1) - private int versionCode = 1; - @SafeParceled(2) - private int status = 0; - - private RemoveLocalCapabilityResponse() { - } - - public RemoveLocalCapabilityResponse(int status) { - this.status = status; - } - - public static final Creator CREATOR = new AutoCreator(RemoveLocalCapabilityResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/SendMessageResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/SendMessageResponse.java deleted file mode 100644 index 8390d333..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/SendMessageResponse.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -import org.microg.safeparcel.AutoSafeParcelable; -import org.microg.safeparcel.SafeParceled; - -public class SendMessageResponse extends AutoSafeParcelable { - - @SafeParceled(1) - private int versionCode = 1; - - @SafeParceled(2) - public int statusCode; - - @SafeParceled(3) - public int requestId = -1; - - public static final Creator CREATOR = new AutoCreator(SendMessageResponse.class); -} diff --git a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/StorageInfoResponse.java b/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/StorageInfoResponse.java deleted file mode 100644 index 53738b20..00000000 --- a/play-services-wearable-api/src/main/java/com/google/android/gms/wearable/internal/StorageInfoResponse.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.internal; - -import org.microg.safeparcel.AutoSafeParcelable; - -public class StorageInfoResponse extends AutoSafeParcelable { - public static final Creator CREATOR = new AutoCreator(StorageInfoResponse.class); -} diff --git a/play-services-wearable/build.gradle b/play-services-wearable/build.gradle deleted file mode 100644 index 084648f9..00000000 --- a/play-services-wearable/build.gradle +++ /dev/null @@ -1,48 +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. - */ - -apply plugin: 'com.android.library' - -android { - compileSdkVersion androidCompileSdk - buildToolsVersion "$androidBuildVersionTools" - - defaultConfig { - versionName version - minSdkVersion androidMinSdk - targetSdkVersion androidTargetSdk - } - - sourceSets { - main { - java.srcDirs += 'src/main/protos-java' - } - } - - compileOptions { - sourceCompatibility = 1.8 - targetCompatibility = 1.8 - } - - lintOptions { - disable 'InvalidPackage' - } -} - -dependencies { - api project(':play-services-base') - implementation 'com.squareup.wire:wire-runtime:1.6.1' -} diff --git a/play-services-wearable/gradle.properties b/play-services-wearable/gradle.properties deleted file mode 100644 index 036604f2..00000000 --- a/play-services-wearable/gradle.properties +++ /dev/null @@ -1,34 +0,0 @@ -# -# 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. -# - -POM_NAME=Play Services Wearable Library -POM_DESCRIPTION=The Play Services Library module to access the Wearable API - -POM_PACKAGING=aar - -POM_URL=https://github.com/microg/android_external_GmsLib - -POM_SCM_URL=https://github.com/microg/android_external_GmsLib -POM_SCM_CONNECTION=scm:git@github.com:microg/android_external_GmsLib.git -POM_SCM_DEV_CONNECTION=scm:git@github.com:microg/android_external_GmsLib.git - -POM_LICENCE_NAME=The Apache Software License, Version 2.0 -POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt -POM_LICENCE_DIST=repo - -POM_DEVELOPER_ID=mar-v-in -POM_DEVELOPER_NAME=Marvin W - diff --git a/play-services-wearable/src/main/AndroidManifest.xml b/play-services-wearable/src/main/AndroidManifest.xml deleted file mode 100644 index c5f892ff..00000000 --- a/play-services-wearable/src/main/AndroidManifest.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - diff --git a/play-services-wearable/src/main/java/com/google/android/gms/wearable/CapabilityApi.java b/play-services-wearable/src/main/java/com/google/android/gms/wearable/CapabilityApi.java deleted file mode 100644 index fe320159..00000000 --- a/play-services-wearable/src/main/java/com/google/android/gms/wearable/CapabilityApi.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import android.net.Uri; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.GoogleApiClient.Builder; -import com.google.android.gms.common.api.PendingResult; -import com.google.android.gms.common.api.Result; -import com.google.android.gms.common.api.Status; - -import org.microg.gms.common.PublicApi; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.util.Map; - -/** - * Exposes an API to learn about capabilities provided by nodes on the Wear network. - *

- * Capabilities are local to an application. - */ -@PublicApi -public interface CapabilityApi { - /** - * Capability changed action for use in manifest-based listener filters. - *

- * Capability events do not support filtering by host, but can be filtered by path. - * - * @see WearableListenerService - */ - String ACTION_CAPABILITY_CHANGED = "com.google.android.gms.wearable.CAPABILITY_CHANGED"; - - /** - * Filter type for {@link #getCapability(GoogleApiClient, String, int)}, {@link #getAllCapabilities(GoogleApiClient, int)}: - * If this filter is set then the full set of nodes that declare the given capability will be - * included in the capability's CapabilityInfo. - */ - int FILTER_ALL = 0; - - /** - * Filter type for {@link #addListener(GoogleApiClient, CapabilityListener, Uri, int)}, if this - * filter is set, the given URI will be taken as a literal path, and the operation will apply - * to the matching capability only. - */ - int FILTER_LITERAL = 0; - - /** - * Filter type for {@link #addListener(GoogleApiClient, CapabilityListener, Uri, int)}, if this - * filter is set, the given URI will be taken as a path prefix, and the operation will apply - * to all matching capabilities. - */ - int FILTER_PREFIX = 1; - - /** - * Filter type for {@link #getCapability(GoogleApiClient, String, int)}, {@link #getAllCapabilities(GoogleApiClient, int): - * If this filter is set then only reachable nodes that declare the given capability will be - * included in the capability's CapabilityInfo. - */ - int FILTER_REACHABLE = 1; - - /** - * Registers a listener to be notified of a specific capability being added to or removed from - * the Wear network. Calls to this method should be balanced with {@link #removeCapabilityListener(GoogleApiClient, CapabilityListener, String)} - * to avoid leaking resources. - *

- * Listener events will be called on the main thread, or the handler specified on {@code client} - * when it was built (using {@link Builder#setHandler(Handler)}). - *

- * Callers wishing to be notified of events in the background should use {@link WearableListenerService}. - */ - PendingResult addCapabilityListener(GoogleApiClient client, CapabilityListener listener, String capability); - - /** - * Registers a listener to be notified of capabilities being added to or removed from the Wear - * network. Calls to this method should be balanced with {@link #removeListener(GoogleApiClient, CapabilityListener)} - * to avoid leaking resources. - *

- * {@code uri} and {@code filterType} can be used to filter the capability changes sent to the - * listener. For example, if {@code uri} and {@code filterType} create a prefix filter, then - * only capabilities matching that prefix will be notified. The {@code uri} follows the rules - * of the {@code } element of {@code }. The path is ignored if a URI host - * is not specified. To match capabilities by name or name prefix, the host must be {@code *}. i.e: - *

- *

wear://* /
- * Listener events will be called on the main thread, or the handler specified on {@code client} - * when it was built (using {@link Builder#setHandler(Handler)}). - * - * Callers wishing to be notified of events in the background should use WearableListenerService. - */ - PendingResult addListener(GoogleApiClient client, CapabilityListener listener, Uri uri, @CapabilityFilterType int filterType); - - /** - * Announces that a capability has become available on the local node. - */ - PendingResult addLocalCapability(GoogleApiClient client, String capability); - - /** - * Returns information about all capabilities, including the nodes that declare those - * capabilities. The filter parameter controls whether all nodes are returned, {@link #FILTER_ALL}, - * or only those that are currently reachable by this node, {@link #FILTER_REACHABLE}. - *

- * The local node will never be returned in the set of nodes. - */ - PendingResult getAllCapabilities(GoogleApiClient client, @NodeFilterType int nodeFilter); - - /** - * Returns information about a capabilities, including the nodes that declare this capability. - * The filter parameter controls whether all nodes are returned, {@link #FILTER_ALL}, or only - * those that are currently reachable by this node, {@link #FILTER_REACHABLE}. - *

- * The local node will never be returned in the set of nodes. - */ - PendingResult getCapability(GoogleApiClient client, String capability, @NodeFilterType int nodeFilter); - - /** - * Removes a listener which was previously added through {@link #addCapabilityListener(GoogleApiClient, CapabilityListener, String)}. - * The listener is only removed from listening for the capability provided and will continue to - * receive messages for any other capabilities it was previously registered for that have not - * also been removed. - */ - PendingResult removeCapabilityListener(GoogleApiClient client, CapabilityListener listener, String capability); - - /** - * Removes a listener which was previously added through {@link #addListener(GoogleApiClient, CapabilityListener, Uri, int)}. - * The listener is only removed from listening for the capability provided and will continue to - * receive messages for any other capabilities it was previously registered for that have not - * also been removed. - */ - PendingResult removeListener(GoogleApiClient client, CapabilityListener listener); - - /** - * Announces that a capability is no longer available on the local node. Note: this will not - * remove any capabilities announced in the Manifest for an app. - */ - PendingResult removeLocalCapability(GoogleApiClient client, String capability); - - /** - * Result returned from {@link #addLocalCapability(GoogleApiClient, String)} - */ - interface AddLocalCapabilityResult extends Result { - } - - @Retention(RetentionPolicy.SOURCE) - @interface CapabilityFilterType { - } - - /** - * Listener for changes in the reachable nodes providing a capability. - */ - interface CapabilityListener { - void onCapabilityChanged(CapabilityInfo capabilityInfo); - } - - /** - * Result returned from {@link #getAllCapabilities(GoogleApiClient, int)} - */ - interface GetAllCapabilitiesResult extends Result { - Map getAllCapabilities(); - } - - /** - * Result returned from {@link #getCapability(GoogleApiClient, String, int)} - */ - interface GetCapabilityResult extends Result { - CapabilityInfo getCapability(); - } - - @Retention(RetentionPolicy.SOURCE) - @interface NodeFilterType { - } - - /** - * Result returned from {@link #removeLocalCapability(GoogleApiClient, String)} - */ - interface RemoveLocalCapabilityResult extends Result { - } -} diff --git a/play-services-wearable/src/main/java/com/google/android/gms/wearable/Channel.java b/play-services-wearable/src/main/java/com/google/android/gms/wearable/Channel.java deleted file mode 100644 index d6d01288..00000000 --- a/play-services-wearable/src/main/java/com/google/android/gms/wearable/Channel.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import android.net.Uri; -import android.os.Parcelable; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.PendingResult; -import com.google.android.gms.common.api.Releasable; -import com.google.android.gms.common.api.Result; -import com.google.android.gms.common.api.Status; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -/** - * A channel created through {@link ChannelApi#openChannel(GoogleApiClient, String, String)}. - *

- * The implementation of this interface is parcelable and immutable, and implements reasonable {@link #equals(Object)} - * and {@link #hashCode()} methods, so can be used in collections. - */ -public interface Channel extends Parcelable { - - PendingResult addListener(GoogleApiClient client, ChannelApi.ChannelListener listener); - - PendingResult close(GoogleApiClient client, int errorCode); - - PendingResult close(GoogleApiClient client); - - PendingResult getInputStream(GoogleApiClient client); - - PendingResult getOutputStream(GoogleApiClient client); - - String getPath(); - - PendingResult receiveFile(GoogleApiClient client, Uri uri, boolean append); - - PendingResult removeListener(GoogleApiClient client, ChannelApi.ChannelListener listener); - - PendingResult sendFile(GoogleApiClient client, Uri uri); - - PendingResult sendFile(GoogleApiClient client, Uri uri, long startOffset, long length); - - interface GetInputStreamResult extends Releasable, Result { - /** - * Returns an input stream which can read data from the remote node. The stream should be - * closed when no longer needed. This method will only return {@code null} if this result's - * {@linkplain #getStatus() status} was not {@linkplain Status#isSuccess() success}. - *

- * The returned stream will throw {@link IOException} on read if any connection errors - * occur. This exception might be a {@link ChannelIOException}. - *

- * Since data for this stream comes over the network, reads may block for a long time. - *

- * Multiple calls to this method will return the same instance. - */ - InputStream getInputStream(); - } - - interface GetOutputStreamResult extends Releasable, Result { - /** - * Returns an output stream which can send data to a remote node. The stream should be - * closed when no longer needed. This method will only return {@code null} if this result's - * {@linkplain #getStatus() status} was not {@linkplain Status#isSuccess() success}. - *

- * The returned stream will throw {@link IOException} on read if any connection errors - * occur. This exception might be a {@link ChannelIOException}. - *

- * Since data for this stream comes over the network, reads may block for a long time. - *

- * Data written to this stream is buffered. If you wish to send the current data without - * waiting for the buffer to fill up, {@linkplain OutputStream#flush() flush} the stream. - *

- * Multiple calls to this method will return the same instance. - */ - OutputStream getOutputStream(); - } -} diff --git a/play-services-wearable/src/main/java/com/google/android/gms/wearable/ChannelApi.java b/play-services-wearable/src/main/java/com/google/android/gms/wearable/ChannelApi.java deleted file mode 100644 index fcd62b7c..00000000 --- a/play-services-wearable/src/main/java/com/google/android/gms/wearable/ChannelApi.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.GoogleApiClient.Builder; -import com.google.android.gms.common.api.PendingResult; -import com.google.android.gms.common.api.Result; -import com.google.android.gms.common.api.Status; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -/** - * Client interface for Wearable Channel API. Allows apps on a wearable device to send and receive - * data from other wearable nodes. - *

- * Channels are bidirectional. Each side, both the initiator and the receiver may both read and - * write to the channel by using {@link Channel#getOutputStream(GoogleApiClient)} and {@link Channel#getInputStream(GoogleApiClient)}. - * Once a channel is established, the API for the initiator and receiver are identical. - *

- * Channels are only available when the wearable nodes are connected. When the remote node - * disconnects, all existing channels will be closed. Any listeners (added through {@link #addListener(GoogleApiClient, ChannelListener)} - * and any installed {@link WearableListenerService}) will be notified of the channel closing. - */ -public interface ChannelApi { - /** - * Channel action for use in listener filters. - * - * @see WearableListenerService - */ - String ACTION_CHANNEL_EVENT = "com.google.android.gms.wearable.CHANNEL_EVENT"; - - /** - * Registers a listener to be notified of channel events. Calls to this method should be - * balanced with calls to {@link #removeListener(GoogleApiClient, ChannelListener)} to avoid - * leaking resources. - *

- * Listener events will be called on the main thread, or the handler specified on {@code client} - * when it was built (using {@link Builder#setHandler(Handler)}). - *

- * Callers wishing to be notified of events in the background should use {@link WearableListenerService}. - * - * @param client a connected client - * @param listener a listener which will be notified of changes to any channel - */ - PendingResult addListener(GoogleApiClient client, ChannelListener listener); - - /** - * Opens a channel to exchange data with a remote node. - *

- * Channel which are no longer needed should be closed using {@link Channel#close(GoogleApiClient)}. - *

- * This call involves a network round trip, so may be long running. {@code client} must remain - * connected during that time, or the request will be cancelled (like any other Play Services - * API calls). - * - * @param client a connected client - * @param nodeId the node ID of a wearable node, as returned from {@link NodeApi#getConnectedNodes(GoogleApiClient)} - * @param path an app-specific identifier for the channel - */ - PendingResult openChannel(GoogleApiClient client, String nodeId, String path); - - /** - * Removes a listener which was previously added through {@link #addListener(GoogleApiClient, ChannelListener)}. - * - * @param client a connected client - * @param listener a listener which was added using {@link #addListener(GoogleApiClient, ChannelListener)} - */ - PendingResult removeListener(GoogleApiClient client, ChannelListener listener); - - /** - * A listener which will be notified on changes to channels. - */ - interface ChannelListener { - /** - * Value passed to {@link #onChannelClosed(Channel, int, int)}, {@link #onInputClosed(Channel, int, int)} - * and {@link #onOutputClosed(Channel, int, int)} when the closing is due to a remote node - * being disconnected. - */ - int CLOSE_REASON_DISCONNECTED = 1; - - /** - * Value passed to {@link #onChannelClosed(Channel, int, int)}, {@link #onInputClosed(Channel, int, int)} - * and {@link #onOutputClosed(Channel, int, int)} when the stream is closed due to the - * local node calling {@link Channel#close(GoogleApiClient)} or {@link Channel#close(GoogleApiClient, int)}. - */ - int CLOSE_REASON_LOCAL_CLOSE = 3; - - /** - * Value passed to {@link #onInputClosed(Channel, int, int)} or {@link #onOutputClosed(Channel, int, int)} - * (but not {@link #onChannelClosed(Channel, int, int)}), when the stream was closed under - * normal conditions, e.g the whole file was read, or the OutputStream on the remote node - * was closed normally. - */ - int CLOSE_REASON_NORMAL = 0; - - /** - * Value passed to {@link #onChannelClosed(Channel, int, int)}, {@link #onInputClosed(Channel, int, int)} - * and {@link #onOutputClosed(Channel, int, int)} when the stream is closed due to the - * remote node calling {@link Channel#close(GoogleApiClient)} or {@link Channel#close(GoogleApiClient, int)}. - */ - int CLOSE_REASON_REMOTE_CLOSE = 2; - - /** - * Called when a channel is closed. This can happen through an explicit call to {@link Channel#close(GoogleApiClient)} - * or {@link #close(GoogleApiClient, int)} on either side of the connection, or due to - * disconnecting from the remote node. - * - * @param closeReason the reason for the channel closing. One of {@link #CLOSE_REASON_DISCONNECTED}, - * {@link #CLOSE_REASON_REMOTE_CLOSE}, or {@link #CLOSE_REASON_LOCAL_CLOSE}. - * @param appSpecificErrorCode the error code specified on {@link Channel#close(GoogleApiClient, int)}, - * or 0 if closeReason is {@link #CLOSE_REASON_DISCONNECTED}. - */ - void onChannelClosed(Channel channel, int closeReason, int appSpecificErrorCode); - - /** - * Called when a new channel is opened by a remote node. - */ - void onChannelOpened(Channel channel); - - /** - * Called when the input side of a channel is closed. - * - * @param closeReason the reason for the channel closing. One of {@link #CLOSE_REASON_DISCONNECTED}, - * {@link #CLOSE_REASON_REMOTE_CLOSE}, {@link #CLOSE_REASON_LOCAL_CLOSE} - * or {@link #CLOSE_REASON_NORMAL}. - * @param appSpecificErrorCode the error code specified on {@link Channel#close(GoogleApiClient, int)}, - * or 0 if closeReason is {@link #CLOSE_REASON_DISCONNECTED} or - * {@link #CLOSE_REASON_NORMAL}. - */ - void onInputClosed(Channel channel, @CloseReason int closeReason, int appSpecificErrorCode); - - /** - * Called when the output side of a channel is closed. - * - * @param closeReason the reason for the channel closing. One of {@link #CLOSE_REASON_DISCONNECTED}, - * {@link #CLOSE_REASON_REMOTE_CLOSE}, {@link #CLOSE_REASON_LOCAL_CLOSE} - * or {@link #CLOSE_REASON_NORMAL}. - * @param appSpecificErrorCode the error code specified on {@link Channel#close(GoogleApiClient, int)}, - * or 0 if closeReason is {@link #CLOSE_REASON_DISCONNECTED} or - * {@link #CLOSE_REASON_NORMAL}. - */ - void onOutputClosed(Channel channel, @CloseReason int closeReason, int appSpecificErrorCode); - } - - /** - * An annotation for values passed to {@link ChannelListener#onChannelClosed(Channel, int, int)}, - * and other methods on the {@link ChannelListener} interface. Annotated method parameters will - * always take one of the following values: - *

    - *
  • {@link ChannelListener#CLOSE_REASON_DISCONNECTED}
  • - *
  • {@link ChannelListener#CLOSE_REASON_NORMAL}
  • - *
  • {@link ChannelListener#CLOSE_REASON_LOCAL_CLOSE}
  • - *
  • {@link ChannelListener#CLOSE_REASON_REMOTE_CLOSE}
  • - *
- */ - @Retention(RetentionPolicy.SOURCE) - @interface CloseReason { - } - - /** - * Result of {@link #openChannel(GoogleApiClient, String, String)}. - */ - interface OpenChannelResult extends Result { - /** - * Returns the newly created channel, or {@code null}, if the connection couldn't be opened. - */ - Channel getChannel(); - } -} diff --git a/play-services-wearable/src/main/java/com/google/android/gms/wearable/ChannelIOException.java b/play-services-wearable/src/main/java/com/google/android/gms/wearable/ChannelIOException.java deleted file mode 100644 index f6143cdd..00000000 --- a/play-services-wearable/src/main/java/com/google/android/gms/wearable/ChannelIOException.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import com.google.android.gms.wearable.ChannelApi.ChannelListener; - -import java.io.IOException; - -/** - * A subclass of {@link IOException} which can be thrown from the streams returned by - * {@link Channel#getInputStream(GoogleApiClient)} and {@link Channel#getOutputStream(GoogleApiClient)}. - */ -public class ChannelIOException extends IOException { - - private int closeReason; - private int appSpecificErrorCode; - - public ChannelIOException(String message, int closeReason, int appSpecificErrorCode) { - super(message); - this.closeReason = closeReason; - this.appSpecificErrorCode = appSpecificErrorCode; - } - - /** - * Returns the app-specific error code passed to {@link Channel#close(GoogleApiClient, int)} if - * that's the reason for the stream closing, or {@code 0} otherwise. - */ - public int getAppSpecificErrorCode() { - return appSpecificErrorCode; - } - - /** - * Returns one of {@link ChannelListener#CLOSE_REASON_NORMAL}, {@link ChannelListener#CLOSE_REASON_DISCONNECTED}, - * {@link ChannelListener#CLOSE_REASON_REMOTE_CLOSE}, or {@link ChannelListener#CLOSE_REASON_LOCAL_CLOSE}, - * to indicate the reason for the stream closing. - */ - public int getCloseReason() { - return closeReason; - } -} diff --git a/play-services-wearable/src/main/java/com/google/android/gms/wearable/DataApi.java b/play-services-wearable/src/main/java/com/google/android/gms/wearable/DataApi.java deleted file mode 100644 index 4327b6c2..00000000 --- a/play-services-wearable/src/main/java/com/google/android/gms/wearable/DataApi.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import android.net.Uri; -import android.os.ParcelFileDescriptor; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.PendingResult; -import com.google.android.gms.common.api.Result; -import com.google.android.gms.common.api.Status; -import com.google.android.gms.common.data.Freezable; -import com.google.android.gms.wearable.internal.PutDataRequest; - -import org.microg.gms.common.PublicApi; - -import java.io.InputStream; - -/** - * Exposes an API for components to read or write data items and assets. - *

- * A {@link DataItem} is synchronized across all devices in an Android Wear network. It is possible - * to set data items while not connected to any nodes. Those data items will be synchronized when - * the nodes eventually come online. - *

- * Data items are private to the application that created them, and are only accessible by that - * application on other nodes. They should generally be small in size, relying on assets for the - * transfer of larger, more persistent data objects such as images. - *

- * Each data item is identified by a URI, accessible with {@link DataItem#getUri()}, that indicates - * the item's creator and path. Fully specified URIs follow the following format: - * {@code wear:///}, where is the node ID of the wearable node that - * created the data item, and is an application-defined path. This means that given a data - * item's URI, calling {@link Uri#getHost()} will return the creator's node ID. - *

- * In some of the methods below (such as {@link #getDataItems(GoogleApiClient, Uri)}), it is - * possible to omit the node ID from the URI, and only leave a path. In that case, the URI may - * refer to multiple data items, since multiple nodes may create data items with the same path. - * Partially specified data item URIs follow the following format: - * {@ocde wear:/} - * Note the single / after wear:. - */ -@PublicApi -public interface DataApi { - /** - * Registers a listener to receive data item changed and deleted events. This call should be - * balanced with a call to {@link #removeListener(GoogleApiClient, DataListener)}, to avoid - * leaking resources. - *

- * The listener will be notified of changes initiated by this node. - */ - PendingResult addListener(GoogleApiClient client, DataListener listener); - - /** - * Removes all specified data items from the Android Wear network. - *

- * If uri is fully specified, this method will delete at most one data item. If {@code uri} - * contains no host, multiple data items may be deleted, since different nodes may create data - * items with the same path. See {@link DataApi} for details of the URI format. - */ - PendingResult deleteDataItems(GoogleApiClient client, Uri uri); - - /** - * Retrieves a single {@link DataItem} from the Android Wear network. A fully qualified URI - * must be specified. The URI's host must be the ID of the node that created the item. - *

- * See {@link DataApi} for details of the URI format. - */ - PendingResult getDataItem(GoogleApiClient client, Uri uri); - - /** - * Retrieves all data items from the Android Wear network. - *

- * Callers must call {@link DataItemBuffer#release()} on the returned buffer when finished - * processing results. - */ - PendingResult getDataItems(GoogleApiClient client); - - /** - * Retrieves all data items matching the provided URI, from the Android Wear network. - *

- * The URI must contain a path. If {@code uri} is fully specified, at most one data item will - * be returned. If uri contains no host, multiple data items may be returned, since different - * nodes may create data items with the same path. See {@link DataApi} for details of the URI - * format. - *

- * Callers must call {@link DataItemBuffer#release()} on the returned buffer when finished - * processing results. - */ - PendingResult getDataItems(GoogleApiClient client, Uri uri); - - /** - * Retrieves a {@link ParcelFileDescriptor} pointing at the bytes of an asset. Only assets - * previously stored in a {@link DataItem} may be retrieved. - */ - PendingResult getFdForAsset(GoogleApiClient client, DataItemAsset asset); - - /** - * Retrieves a {@link ParcelFileDescriptor} pointing at the bytes of an asset. Only assets - * previously stored in a {@link DataItem} may be retrieved. - */ - PendingResult getFdForAsset(GoogleApiClient client, Asset asset); - - /** - * Adds a {@link DataItem} to the Android Wear network. The updated item is synchronized across - * all devices. - */ - PendingResult putDataItem(GoogleApiClient client, PutDataRequest request); - - /** - * Removes a data listener which was previously added through - * {@link #addListener(GoogleApiClient, DataListener)}. - */ - PendingResult removeListener(GoogleApiClient client, DataListener listener); - - interface DataItemResult extends Result { - /** - * @return data item, or {@code null} if the item does not exit. - */ - DataItem getDataItem(); - } - - interface DataListener { - /** - * Notification that a set of data items have been changed or deleted. The data buffer is - * released upon completion of this method. If a caller wishes to use the events outside - * this callback, they should be sure to {@link Freezable#freeze()} the DataEvent objects - * they wish to use. - */ - void onDataChanged(DataEventBuffer dataEvents); - } - - interface DeleteDataItemsResult extends Result { - /** - * @return the number of items deleted by - * {@link DataApi#deleteDataItems(GoogleApiClient, Uri)}. - */ - int getNumDeleted(); - } - - interface GetFdForAssetResult extends Result { - /** - * @return a file descriptor for the requested asset. - */ - ParcelFileDescriptor getFd(); - - /** - * @return an input stream wrapping the file descriptor. When this input stream is closed, the file descriptor is, as well. - */ - InputStream getInputStream(); - } -} diff --git a/play-services-wearable/src/main/java/com/google/android/gms/wearable/DataEvent.java b/play-services-wearable/src/main/java/com/google/android/gms/wearable/DataEvent.java deleted file mode 100644 index 51e86397..00000000 --- a/play-services-wearable/src/main/java/com/google/android/gms/wearable/DataEvent.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import com.google.android.gms.common.data.Freezable; - -import org.microg.gms.common.PublicApi; - -/** - * Data interface for data events. - */ -@PublicApi -public interface DataEvent extends Freezable { - - /** - * Indicates that the enclosing {@link DataEvent} was triggered by a data item being added or - * changed. - */ - int TYPE_CHANGED = 1; - - /** - * Indicates that the enclosing {@link DataEvent} was triggered by a data item being deleted. - */ - int TYPE_DELETED = 2; - - /** - * @return the data item modified in this event. An event of {@link #TYPE_DELETED} will only - * have its {@link DataItem#getUri} populated. - */ - DataItem getDataItem(); - - /** - * @return the type of event this is. One of {@link #TYPE_CHANGED}, {@link #TYPE_DELETED}. - */ - int getType(); -} diff --git a/play-services-wearable/src/main/java/com/google/android/gms/wearable/DataEventBuffer.java b/play-services-wearable/src/main/java/com/google/android/gms/wearable/DataEventBuffer.java deleted file mode 100644 index 1c6c98e0..00000000 --- a/play-services-wearable/src/main/java/com/google/android/gms/wearable/DataEventBuffer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import com.google.android.gms.common.api.Result; -import com.google.android.gms.common.api.Status; -import com.google.android.gms.common.data.DataBuffer; -import com.google.android.gms.common.data.DataHolder; - -import org.microg.gms.common.PublicApi; - -/** - * Data structure holding references to a set of events. - */ -@PublicApi -public class DataEventBuffer extends DataBuffer implements Result { - private Status status; - - @PublicApi(exclude = true) - public DataEventBuffer(DataHolder dataHolder) { - super(dataHolder); - status = new Status(dataHolder.getStatusCode()); - } - - @Override - public DataEvent get(int position) { - return null; - } - - @Override - public Status getStatus() { - return null; - } -} diff --git a/play-services-wearable/src/main/java/com/google/android/gms/wearable/DataItemBuffer.java b/play-services-wearable/src/main/java/com/google/android/gms/wearable/DataItemBuffer.java deleted file mode 100644 index 703d7ae3..00000000 --- a/play-services-wearable/src/main/java/com/google/android/gms/wearable/DataItemBuffer.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import com.google.android.gms.common.api.Result; -import com.google.android.gms.common.api.Status; -import com.google.android.gms.common.data.DataBuffer; -import com.google.android.gms.common.data.DataHolder; - -import org.microg.gms.common.PublicApi; - -@PublicApi -public class DataItemBuffer extends DataBuffer implements Result { - private Status status; - - @PublicApi(exclude = true) - public DataItemBuffer(DataHolder dataHolder) { - super(dataHolder); - status = new Status(dataHolder.getStatusCode()); - } - - @Override - public DataItem get(int position) { - return null; - } - - @Override - public Status getStatus() { - return null; - } -} diff --git a/play-services-wearable/src/main/java/com/google/android/gms/wearable/DataMap.java b/play-services-wearable/src/main/java/com/google/android/gms/wearable/DataMap.java deleted file mode 100644 index f46c4920..00000000 --- a/play-services-wearable/src/main/java/com/google/android/gms/wearable/DataMap.java +++ /dev/null @@ -1,463 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import android.os.Bundle; - -import org.microg.gms.common.PublicApi; -import org.microg.gms.wearable.databundle.DataBundleUtil; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import static org.microg.gms.wearable.databundle.DataBundleUtil.ASSET_TYPE_CODE; -import static org.microg.gms.wearable.databundle.DataBundleUtil.BOOLEAN_TYPE_CODE; -import static org.microg.gms.wearable.databundle.DataBundleUtil.BYTE_ARRAY_TYPE_CODE; -import static org.microg.gms.wearable.databundle.DataBundleUtil.BYTE_TYPE_CODE; -import static org.microg.gms.wearable.databundle.DataBundleUtil.DATAMAP_TYPE_CODE; -import static org.microg.gms.wearable.databundle.DataBundleUtil.DOUBLE_TYPE_CODE; -import static org.microg.gms.wearable.databundle.DataBundleUtil.FLOAT_ARRAY_TYPE_CODE; -import static org.microg.gms.wearable.databundle.DataBundleUtil.FLOAT_TYPE_CODE; -import static org.microg.gms.wearable.databundle.DataBundleUtil.INTEGER_TYPE_CODE; -import static org.microg.gms.wearable.databundle.DataBundleUtil.LIST_TYPE_CODE; -import static org.microg.gms.wearable.databundle.DataBundleUtil.LONG_ARRAY_TYPE_CODE; -import static org.microg.gms.wearable.databundle.DataBundleUtil.LONG_TYPE_CODE; -import static org.microg.gms.wearable.databundle.DataBundleUtil.STRING_ARRAY_TYPE_CODE; -import static org.microg.gms.wearable.databundle.DataBundleUtil.STRING_TYPE_CODE; - -/** - * A map of data supported by {@link PutDataMapRequest} and {@link DataMapItem}s. DataMap may - * convert to and from Bundles, but will drop any types not explicitly supported by DataMap in the - * conversion process. - */ -@PublicApi -public class DataMap { - public static String TAG = "GmsDataMap"; - - private Map data = new HashMap(); - private Map types = new HashMap(); - - public DataMap() { - - } - - /** - * @return an ArrayList of DataMaps from an ArrayList of Bundles. Any elements in the Bundles not supported by DataMap will be dropped. - */ - public static ArrayList arrayListFromBundleArrayList(ArrayList bundleArrayList) { - ArrayList res = new ArrayList(); - for (Bundle bundle : bundleArrayList) { - res.add(fromBundle(bundle)); - } - return res; - } - - /** - * Removes all elements from the mapping of this DataMap. - */ - public void clear() { - data.clear(); - } - - /** - * @return true if the given key is contained in the mapping of this DataMap. - */ - public boolean containsKey(String key) { - return data.containsKey(key); - } - - /** - * @return true if the given Object is a DataMap equivalent to this one. - */ - @Override - public boolean equals(Object o) { - return o instanceof DataMap && data.equals(((DataMap) o).data); - } - - public StoredType getType(String key) { - return types.get(key); - } - - @PublicApi(exclude = true) - public enum StoredType { - Asset(ASSET_TYPE_CODE), Boolean(BOOLEAN_TYPE_CODE), Byte(BYTE_TYPE_CODE), - ByteArray(BYTE_ARRAY_TYPE_CODE), DataMap(DATAMAP_TYPE_CODE), DataMapArrayList(DataMap), - Double(DOUBLE_TYPE_CODE), Float(FLOAT_TYPE_CODE), FloatArray(FLOAT_ARRAY_TYPE_CODE), - Integer(INTEGER_TYPE_CODE), IntegerArrayList(Integer), Long(LONG_TYPE_CODE), - LongArray(LONG_ARRAY_TYPE_CODE), String(STRING_TYPE_CODE), - StringArray(STRING_ARRAY_TYPE_CODE), StringArrayList(String); - - private int typeCode; - private StoredType listType; - - StoredType(int typeCode) { - this.typeCode = typeCode; - } - - StoredType(StoredType listType) { - this.typeCode = LIST_TYPE_CODE; - this.listType = listType; - } - - public int getTypeCode() { - return typeCode; - } - - public StoredType getListType() { - return listType; - } - } - - /** - * @return a DataMap from a Bundle. The input Bundle is expected to contain only elements - * supported by DataMap. Any elements in the Bundle not supported by DataMap will be dropped. - */ - public static DataMap fromBundle(Bundle bundle) { - DataMap res = new DataMap(); - if (bundle != null) { - for (String key : bundle.keySet()) { - Object val = bundle.get(key); - if (val instanceof Asset) { - res.putAsset(key, (Asset) val); - } else if (val instanceof Boolean) { - res.putBoolean(key, (Boolean) val); - } else if (val instanceof Byte) { - res.putByte(key, (Byte) val); - } else if (val instanceof byte[]) { - res.putByteArray(key, (byte[]) val); - } else if (val instanceof Bundle) { - res.putDataMap(key, DataMap.fromBundle((Bundle) val)); - } else if (val instanceof Double) { - res.putDouble(key, (Double) val); - } else if (val instanceof Float) { - res.putFloat(key, (Float) val); - } else if (val instanceof float[]) { - res.putFloatArray(key, (float[]) val); - } else if (val instanceof Integer) { - res.putInt(key, (Integer) val); - } else if (val instanceof Long) { - res.putLong(key, (Long) val); - } else if (val instanceof long[]) { - res.putLongArray(key, (long[]) val); - } else if (val instanceof String) { - res.putString(key, (String) val); - } else if (val instanceof String[]) { - res.putStringArray(key, (String[]) val); - } else if (val instanceof ArrayList) { - if (((ArrayList) val).isEmpty() || ((ArrayList) val).get(0) instanceof String) { - res.putStringArrayList(key, (ArrayList) val); - } else if (((ArrayList) val).get(0) instanceof Bundle) { - ArrayList dataMaps = new ArrayList(); - for (Bundle b : ((ArrayList) val)) { - dataMaps.add(DataMap.fromBundle(b)); - } - res.putDataMapArrayList(key, dataMaps); - } else if (((ArrayList) val).get(0) instanceof Integer) { - res.putIntegerArrayList(key, (ArrayList) val); - } - } - } - } - return res; - } - - /** - * @return a DataMap from a byte[]. - */ - public static DataMap fromByteArray(byte[] bytes) { - return DataBundleUtil.readDataMap(bytes, Collections.emptyList()); - } - - /** - * @return the entry with the given key as an object, or null - */ - public T get(String key) { - return (T) data.get(key); - } - - public Asset getAsset(String key) { - return types.get(key) == StoredType.Asset ? (Asset) data.get(key) : null; - } - - public boolean getBoolean(String key) { - return getBoolean(key, false); - } - - public boolean getBoolean(String key, boolean defaultValue) { - return types.get(key) == StoredType.Boolean ? (Boolean) data.get(key) : defaultValue; - } - - public byte getByte(String key) { - return getByte(key, (byte) 0); - } - - public byte getByte(String key, byte defaultValue) { - return types.get(key) == StoredType.Byte ? (Byte) data.get(key) : defaultValue; - } - - public byte[] getByteArray(String key) { - return types.get(key) == StoredType.ByteArray ? (byte[]) data.get(key) : null; - } - - public DataMap getDataMap(String key) { - return types.get(key) == StoredType.DataMap ? (DataMap) data.get(key) : null; - } - - public ArrayList getDataMapArrayList(String key) { - return types.get(key) == StoredType.DataMapArrayList ? (ArrayList) data.get(key) : null; - } - - public double getDouble(String key) { - return getDouble(key, 0.0); - } - - public double getDouble(String key, double defaultValue) { - return types.get(key) == StoredType.Double ? (Double) data.get(key) : defaultValue; - } - - public float getFloat(String key) { - return getFloat(key, 0.0f); - } - - public float getFloat(String key, float defaultValue) { - return types.get(key) == StoredType.Float ? (Float) data.get(key) : defaultValue; - } - - public float[] getFloatArray(String key) { - return types.get(key) == StoredType.FloatArray ? (float[]) data.get(key) : null; - } - - public int getInt(String key) { - return getInt(key, 0); - } - - public int getInt(String key, int defaultValue) { - return types.get(key) == StoredType.Integer ? (Integer) data.get(key) : defaultValue; - } - - public ArrayList getIntegerArrayList(String key) { - return types.get(key) == StoredType.IntegerArrayList ? (ArrayList) data.get(key) : null; - } - - public long getLong(String key) { - return getLong(key, 0L); - } - - public long getLong(String key, long defaultValue) { - return types.get(key) == StoredType.Long ? (Long) data.get(key) : defaultValue; - } - - public long[] getLongArray(String key) { - return types.get(key) == StoredType.LongArray ? (long[]) data.get(key) : null; - } - - public String getString(String key) { - return getString(key, null); - } - - public String getString(String key, String defaultValue) { - return types.get(key) == StoredType.String ? (String) data.get(key) : defaultValue; - } - - public String[] getStringArray(String key) { - return types.get(key) == StoredType.StringArray ? (String[]) data.get(key) : null; - } - - public ArrayList getStringArrayList(String key) { - return types.get(key) == StoredType.StringArrayList ? (ArrayList) data.get(key) : null; - } - - public int hashCode() { - return data.hashCode(); - } - - public boolean isEmpty() { - return data.isEmpty(); - } - - public Set keySet() { - return data.keySet(); - } - - public void putAll(DataMap dataMap) { - for (String key : dataMap.keySet()) { - data.put(key, dataMap.data.get(key)); - types.put(key, dataMap.types.get(key)); - } - } - - public void putAsset(String key, Asset value) { - data.put(key, value); - types.put(key, StoredType.Asset); - } - - public void putBoolean(String key, boolean value) { - data.put(key, value); - types.put(key, StoredType.Boolean); - } - - public void putByte(String key, byte value) { - data.put(key, value); - types.put(key, StoredType.Byte); - } - - public void putByteArray(String key, byte[] value) { - data.put(key, value); - types.put(key, StoredType.ByteArray); - } - - public void putDataMap(String key, DataMap value) { - data.put(key, value); - types.put(key, StoredType.DataMap); - } - - public void putDataMapArrayList(String key, ArrayList value) { - data.put(key, value); - types.put(key, StoredType.DataMapArrayList); - } - - public void putDouble(String key, double value) { - data.put(key, value); - types.put(key, StoredType.Double); - } - - public void putFloat(String key, float value) { - data.put(key, value); - types.put(key, StoredType.Float); - } - - public void putFloatArray(String key, float[] value) { - data.put(key, value); - types.put(key, StoredType.FloatArray); - } - - public void putInt(String key, int value) { - data.put(key, value); - types.put(key, StoredType.Integer); - } - - public void putIntegerArrayList(String key, ArrayList value) { - data.put(key, value); - types.put(key, StoredType.IntegerArrayList); - } - - public void putLong(String key, long value) { - data.put(key, value); - types.put(key, StoredType.Long); - } - - public void putLongArray(String key, long[] value) { - data.put(key, value); - types.put(key, StoredType.LongArray); - } - - public void putString(String key, String value) { - data.put(key, value); - types.put(key, StoredType.String); - } - - public void putStringArray(String key, String[] value) { - data.put(key, value); - types.put(key, StoredType.StringArray); - } - - public void putStringArrayList(String key, ArrayList value) { - data.put(key, value); - types.put(key, StoredType.StringArrayList); - } - - public Object remove(String key) { - types.remove(key); - return data.remove(key); - } - - public int size() { - return data.size(); - } - - public Bundle toBundle() { - Bundle bundle = new Bundle(); - for (String key : data.keySet()) { - switch (types.get(key)) { - case Asset: - bundle.putParcelable(key, (Asset) data.get(key)); - break; - case Boolean: - bundle.putBoolean(key, (Boolean) data.get(key)); - break; - case Byte: - bundle.putByte(key, (Byte) data.get(key)); - break; - case ByteArray: - bundle.putByteArray(key, (byte[]) data.get(key)); - break; - case DataMap: - bundle.putBundle(key, ((DataMap) data.get(key)).toBundle()); - break; - case DataMapArrayList: - ArrayList bundles = new ArrayList(); - for (DataMap dataMap : ((ArrayList) data.get(key))) { - bundles.add(dataMap.toBundle()); - } - bundle.putParcelableArrayList(key, bundles); - break; - case Double: - bundle.putDouble(key, (Double) data.get(key)); - break; - case Float: - bundle.putFloat(key, (Float) data.get(key)); - break; - case FloatArray: - bundle.putFloatArray(key, (float[]) data.get(key)); - break; - case Integer: - bundle.putInt(key, (Integer) data.get(key)); - break; - case IntegerArrayList: - bundle.putIntegerArrayList(key, (ArrayList) data.get(key)); - break; - case Long: - bundle.putLong(key, (Long) data.get(key)); - break; - case LongArray: - bundle.putLongArray(key, (long[]) data.get(key)); - break; - case String: - bundle.putString(key, (String) data.get(key)); - break; - case StringArray: - bundle.putStringArray(key, (String[]) data.get(key)); - break; - case StringArrayList: - bundle.putStringArrayList(key, (ArrayList) data.get(key)); - break; - } - } - return bundle; - } - - public byte[] toByteArray() { - return DataBundleUtil.createBytes(this); - } - - public String toString() { - return "DataMap{size=" + size() + "}"; - } -} diff --git a/play-services-wearable/src/main/java/com/google/android/gms/wearable/DataMapItem.java b/play-services-wearable/src/main/java/com/google/android/gms/wearable/DataMapItem.java deleted file mode 100644 index 670260d4..00000000 --- a/play-services-wearable/src/main/java/com/google/android/gms/wearable/DataMapItem.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import android.net.Uri; - -import org.microg.gms.common.PublicApi; - -/** - * Creates a new dataItem-like object containing structured and serializable data. - */ -@PublicApi -public class DataMapItem { - /** - * Provides a {@link DataMapItem} wrapping a dataItem. - * - * @param dataItem the base for the wrapped {@link DataMapItem}. {@code dataItem} should not - * be modified after wrapping it. - */ - public static DataMapItem fromDataItem(DataItem dataItem) { - return null; - } - - public DataMap getDataMap() { - return null; - } - - public Uri getUri() { - return null; - } -} diff --git a/play-services-wearable/src/main/java/com/google/android/gms/wearable/MessageApi.java b/play-services-wearable/src/main/java/com/google/android/gms/wearable/MessageApi.java deleted file mode 100644 index 1e68ad1d..00000000 --- a/play-services-wearable/src/main/java/com/google/android/gms/wearable/MessageApi.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.PendingResult; -import com.google.android.gms.common.api.Result; -import com.google.android.gms.common.api.Status; - -import org.microg.gms.common.PublicApi; - -@PublicApi -public interface MessageApi { - - /** - * A value returned by {@link SendMessageResult#getRequestId()} when - * {@link #sendMessage(GoogleApiClient, String, String, byte[])} fails. - */ - int UNKNOWN_REQUEST_ID = -1; - - /** - * Registers a listener to be notified of received messages. Calls to this method should - * balanced with {@link #removeListener(GoogleApiClient, MessageListener)} to avoid leaking - * resources. - *

- * Callers wishing to be notified of events in the background should use {@link WearableListenerService}. - */ - PendingResult addListener(GoogleApiClient client, MessageListener listener); - - /** - * Removes a message listener which was previously added through - * {@link #addListener(GoogleApiClient, MessageListener)}. - */ - PendingResult removeListener(GoogleApiClient client, MessageListener listener); - - /** - * Sends {@code byte[]} data to the specified node. - * - * @param nodeId identifier for a particular node on the Android Wear network. Valid targets - * may be obtained through {@link NodeApi#getConnectedNodes(GoogleApiClient)} - * or from the host in {@link DataItem#getUri()}. - * @param path identifier used to specify a particular endpoint at the receiving node - * @param data small array of information to pass to the target node. Generally not larger - * than 100k - */ - PendingResult sendMessage(GoogleApiClient client, String nodeId, - String path, byte[] data); - - /** - * Used with {@link MessageApi#addListener(GoogleApiClient, MessageListener)} to receive - * message events. - *

- * Callers wishing to be notified of events in the background should use - * {@link WearableListenerService}. - */ - interface MessageListener { - /** - * Notification that a message has been received. - */ - void onMessageReceived(MessageEvent messageEvent); - } - - /** - * Contains the request id assigned to the message. On failure, the id will be - * {@link MessageApi#UNKNOWN_REQUEST_ID} and the status will be unsuccessful. - */ - interface SendMessageResult extends Result { - /** - * @return an ID used to identify the sent message. If {@link #getStatus()} is not - * successful, this value will be {@link MessageApi#UNKNOWN_REQUEST_ID}. - */ - int getRequestId(); - } -} diff --git a/play-services-wearable/src/main/java/com/google/android/gms/wearable/NodeApi.java b/play-services-wearable/src/main/java/com/google/android/gms/wearable/NodeApi.java deleted file mode 100644 index 6c6a188f..00000000 --- a/play-services-wearable/src/main/java/com/google/android/gms/wearable/NodeApi.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.PendingResult; -import com.google.android.gms.common.api.Result; -import com.google.android.gms.common.api.Status; - -import org.microg.gms.common.PublicApi; - -import java.util.List; - -/** - * Exposes an API for to learn about local or connected Nodes. - *

- * Node events are delivered to all applications on a device. - */ -@PublicApi -public interface NodeApi { - - /** - * Registers a listener to receive all node events. Calls to this method should balanced with - * {@link #removeListener(GoogleApiClient, NodeListener)}, to avoid leaking resources. - *

- * Callers wishing to be notified of node events in the background should use WearableListenerService. - */ - PendingResult addListener(GoogleApiClient client, NodeListener listener); - - /** - * Gets a list of nodes to which this device is currently connected. - *

- * The returned list will not include the {@link #getLocalNode(GoogleApiClient) local node}. - */ - PendingResult getConnectedNodes(GoogleApiClient client); - - /** - * Gets the {@link Node} that refers to this device. The information in the returned Node - * can be passed to other devices using the {@link MessageApi}, for example. - */ - PendingResult getLocalNode(GoogleApiClient client); - - /** - * Removes a listener which was previously added through - * {@link #addListener(GoogleApiClient, NodeListener)}. - */ - PendingResult removeListener(GoogleApiClient client, NodeListener listener); - - - /** - * Contains a list of connected nodes. - */ - interface GetConnectedNodesResult extends Result { - /** - * @return a list of connected nodes. This list doesn't include the local node. - */ - List getNodes(); - } - - /** - * Contains the name and id that represents this device. - */ - interface GetLocalNodeResult extends Result { - /** - * @return a {@link Node} object which represents this device. - */ - Node getNode(); - } - - /** - * Used with {@link NodeApi#addListener(GoogleApiClient, NodeListener)} to receive node events. - */ - interface NodeListener { - /** - * Notification that a peer has been connected. - */ - void onPeerConnected(Node peer); - - /** - * Notification that a peer has been disconnected. - */ - void onPeerDisconnected(Node peer); - } -} diff --git a/play-services-wearable/src/main/java/com/google/android/gms/wearable/PutDataMapRequest.java b/play-services-wearable/src/main/java/com/google/android/gms/wearable/PutDataMapRequest.java deleted file mode 100644 index d92167cc..00000000 --- a/play-services-wearable/src/main/java/com/google/android/gms/wearable/PutDataMapRequest.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import android.net.Uri; - -import com.google.android.gms.wearable.internal.PutDataRequest; - -import org.microg.gms.common.PublicApi; - -/** - * PutDataMapRequest is a DataMap-aware version of {@link PutDataRequest}. - */ -@PublicApi -public class PutDataMapRequest { - - private DataMapItem dataMapItem; - - private PutDataMapRequest(DataMapItem dataMapItem) { - this.dataMapItem = dataMapItem; - } - - /** - * Creates a {@link PutDataRequest} containing the data and assets in this - * {@link PutDataMapRequest}. - */ - public PutDataRequest asPutDataRequest() { - // TODO - return PutDataRequest.create((Uri) null); - } - - /** - * Creates a {@link PutDataMapRequest} with the provided, complete, path. - */ - public static PutDataMapRequest create(String path) { - // TODO - return new PutDataMapRequest(null); - } - - /** - * Creates a {@link PutDataMapRequest} from a {@link DataMapItem} using the provided source. - */ - public static PutDataMapRequest createFromDataMapItem(DataMapItem source) { - return new PutDataMapRequest(source); - } - - /** - * Creates a {@link PutDataMapRequest} with a randomly generated id prefixed with the provided - * path. - */ - public static PutDataMapRequest createWithAutoAppendedId(String pathPrefix) { - // TODO - return new PutDataMapRequest(null); - } - - /** - * @return the structured data associated with this data item. - */ - public DataMap getDataMap() { - return dataMapItem.getDataMap(); - } - - /** - * @return a {@link Uri} for the pending data item. If this is a modification of an existing - * data item, {@link Uri#getHost()} will return the id of the node that originally created it. - * Otherwise, a new data item will be created with the requesting device's node. - */ - public Uri getUri() { - return dataMapItem.getUri(); - } -} diff --git a/play-services-wearable/src/main/java/com/google/android/gms/wearable/Wearable.java b/play-services-wearable/src/main/java/com/google/android/gms/wearable/Wearable.java deleted file mode 100644 index 88899989..00000000 --- a/play-services-wearable/src/main/java/com/google/android/gms/wearable/Wearable.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import com.google.android.gms.common.api.Api; -import com.google.android.gms.common.api.GoogleApiClient; - -import org.microg.gms.common.PublicApi; -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. - */ -@PublicApi -public class Wearable { - /** - * Token to pass to {@link GoogleApiClient.Builder#addApi(Api)} to enable the Wearable features. - */ - public static final Api 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 { - /** - * Special option for microG to allow implementation of a FOSS first party Android Wear app - */ - @PublicApi(exclude = true) - public boolean firstPartyMode = false; - - public static class Builder { - public WearableOptions build() { - return new WearableOptions(); - } - } - } -} diff --git a/play-services-wearable/src/main/java/com/google/android/gms/wearable/WearableListenerService.java b/play-services-wearable/src/main/java/com/google/android/gms/wearable/WearableListenerService.java deleted file mode 100644 index 8aa5b091..00000000 --- a/play-services-wearable/src/main/java/com/google/android/gms/wearable/WearableListenerService.java +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import android.app.Service; -import android.content.Intent; -import android.os.Binder; -import android.os.Handler; -import android.os.HandlerThread; -import android.os.IBinder; -import android.os.Looper; -import android.os.RemoteException; -import android.util.Log; - -import com.google.android.gms.common.data.DataHolder; -import com.google.android.gms.wearable.internal.AmsEntityUpdateParcelable; -import com.google.android.gms.wearable.internal.AncsNotificationParcelable; -import com.google.android.gms.wearable.internal.CapabilityInfoParcelable; -import com.google.android.gms.wearable.internal.ChannelEventParcelable; -import com.google.android.gms.wearable.internal.IWearableListener; -import com.google.android.gms.wearable.internal.MessageEventParcelable; -import com.google.android.gms.wearable.internal.NodeParcelable; - -import org.microg.gms.common.PublicApi; -import org.microg.gms.wearable.ChannelImpl; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static org.microg.gms.common.Constants.GMS_PACKAGE_NAME; - -@PublicApi -public abstract class WearableListenerService extends Service implements CapabilityApi.CapabilityListener, ChannelApi.ChannelListener, DataApi.DataListener, MessageApi.MessageListener, NodeApi.NodeListener { - private static final String BIND_LISTENER_INTENT_ACTION = "com.google.android.gms.wearable.BIND_LISTENER"; - private static final String TAG = "GmsWearListenerSvc"; - - private HandlerThread handlerThread; - private IWearableListener listener; - private ServiceHandler serviceHandler; - private Object lock = new Object(); - private boolean disconnected = false; - - @Override - public IBinder onBind(Intent intent) { - if (BIND_LISTENER_INTENT_ACTION.equals(intent.getAction())) { - return listener.asBinder(); - } - return null; - } - - @Override - public void onCapabilityChanged(CapabilityInfo capabilityInfo) { - } - - public void onConnectedNodes(List connectedNodes) { - } - - @Override - public void onChannelClosed(Channel channel, int closeReason, int appSpecificErrorCode) { - } - - @Override - public void onChannelOpened(Channel channel) { - } - - @Override - public void onCreate() { - super.onCreate(); - handlerThread = new HandlerThread("WearableListenerService"); - handlerThread.start(); - serviceHandler = new ServiceHandler(handlerThread.getLooper()); - listener = new Listener(); - } - - @Override - public void onDataChanged(DataEventBuffer dataEvents) { - } - - @Override - public void onDestroy() { - synchronized (lock) { - if (serviceHandler == null) { - throw new IllegalStateException("serviceHandler not set, did you override onCreate() but forget to call super.onCreate()?"); - } - serviceHandler.getLooper().quit(); - } - super.onDestroy(); - } - - @PublicApi(exclude = true) - public void onEntityUpdate(AmsEntityUpdate entityUpdate) { - } - - @Override - public void onInputClosed(Channel channel, @ChannelApi.CloseReason int closeReason, int appSpecificErrorCode) { - } - - @Override - public void onMessageReceived(MessageEvent messageEvent) { - } - - @PublicApi(exclude = true) - public void onNotificationReceived(AncsNotification notification) { - } - - @Override - public void onOutputClosed(Channel channel, @ChannelApi.CloseReason int closeReason, int appSpecificErrorCode) { - } - - @Override - public void onPeerConnected(Node peer) { - } - - @Override - public void onPeerDisconnected(Node peer) { - } - - private class Listener extends IWearableListener.Stub { - private int knownGoodUid = -1; - - private boolean post(Runnable runnable) { - int callingUid = Binder.getCallingUid(); - if (callingUid != knownGoodUid) { - // TODO: Verify Gms is calling - String[] packagesForUid = getPackageManager().getPackagesForUid(callingUid); - if (packagesForUid != null) { - if (Arrays.asList(packagesForUid).contains(GMS_PACKAGE_NAME)) { - knownGoodUid = callingUid; - } else { - throw new SecurityException("Caller is not Services Core"); - } - } - } - synchronized (lock) { - if (disconnected) { - return false; - } - serviceHandler.post(runnable); - return true; - } - } - - @Override - public void onDataChanged(final DataHolder data) throws RemoteException { - post(new Runnable() { - @Override - public void run() { - WearableListenerService.this.onDataChanged(new DataEventBuffer(data)); - } - }); - } - - @Override - public void onMessageReceived(final MessageEventParcelable messageEvent) throws RemoteException { - post(new Runnable() { - @Override - public void run() { - WearableListenerService.this.onMessageReceived(messageEvent); - } - }); - } - - @Override - public void onPeerConnected(final NodeParcelable node) throws RemoteException { - post(new Runnable() { - @Override - public void run() { - WearableListenerService.this.onPeerConnected(node); - } - }); - } - - @Override - public void onPeerDisconnected(final NodeParcelable node) throws RemoteException { - post(new Runnable() { - @Override - public void run() { - WearableListenerService.this.onPeerDisconnected(node); - } - }); - } - - @Override - public void onConnectedNodes(final List nodes) throws RemoteException { - post(new Runnable() { - @Override - public void run() { - WearableListenerService.this.onConnectedNodes(new ArrayList(nodes)); - } - }); - } - - @Override - public void onConnectedCapabilityChanged(final CapabilityInfoParcelable capabilityInfo) throws RemoteException { - post(new Runnable() { - @Override - public void run() { - WearableListenerService.this.onCapabilityChanged(capabilityInfo); - } - }); - } - - @Override - public void onNotificationReceived(final AncsNotificationParcelable notification) throws RemoteException { - post(new Runnable() { - @Override - public void run() { - WearableListenerService.this.onNotificationReceived(notification); - } - }); - } - - @Override - public void onEntityUpdate(final AmsEntityUpdateParcelable update) throws RemoteException { - post(new Runnable() { - @Override - public void run() { - WearableListenerService.this.onEntityUpdate(update); - } - }); - } - - @Override - public void onChannelEvent(final ChannelEventParcelable channelEvent) throws RemoteException { - post(new Runnable() { - @Override - public void run() { - switch (channelEvent.eventType) { - case 1: - WearableListenerService.this.onChannelOpened(new ChannelImpl(channelEvent.channel)); - break; - case 2: - WearableListenerService.this.onChannelClosed(new ChannelImpl(channelEvent.channel), channelEvent.closeReason, channelEvent.appSpecificErrorCode); - break; - case 3: - WearableListenerService.this.onInputClosed(new ChannelImpl(channelEvent.channel), channelEvent.closeReason, channelEvent.appSpecificErrorCode); - break; - case 4: - WearableListenerService.this.onOutputClosed(new ChannelImpl(channelEvent.channel), channelEvent.closeReason, channelEvent.appSpecificErrorCode); - break; - default: - Log.w(TAG, "Unknown ChannelEvent.eventType"); - } - } - }); - } - } - - private class ServiceHandler extends Handler { - public ServiceHandler(Looper looper) { - super(looper); - } - } -} diff --git a/play-services-wearable/src/main/java/org/microg/gms/wearable/BaseWearableCallbacks.java b/play-services-wearable/src/main/java/org/microg/gms/wearable/BaseWearableCallbacks.java deleted file mode 100644 index 14778527..00000000 --- a/play-services-wearable/src/main/java/org/microg/gms/wearable/BaseWearableCallbacks.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import android.os.RemoteException; -import android.util.Log; - -import com.google.android.gms.common.api.Status; -import com.google.android.gms.common.data.DataHolder; -import com.google.android.gms.wearable.internal.AddLocalCapabilityResponse; -import com.google.android.gms.wearable.internal.ChannelReceiveFileResponse; -import com.google.android.gms.wearable.internal.ChannelSendFileResponse; -import com.google.android.gms.wearable.internal.CloseChannelResponse; -import com.google.android.gms.wearable.internal.DeleteDataItemsResponse; -import com.google.android.gms.wearable.internal.GetAllCapabilitiesResponse; -import com.google.android.gms.wearable.internal.GetCapabilityResponse; -import com.google.android.gms.wearable.internal.GetChannelInputStreamResponse; -import com.google.android.gms.wearable.internal.GetChannelOutputStreamResponse; -import com.google.android.gms.wearable.internal.GetCloudSyncOptInOutDoneResponse; -import com.google.android.gms.wearable.internal.GetCloudSyncOptInStatusResponse; -import com.google.android.gms.wearable.internal.GetCloudSyncSettingResponse; -import com.google.android.gms.wearable.internal.GetConfigResponse; -import com.google.android.gms.wearable.internal.GetConfigsResponse; -import com.google.android.gms.wearable.internal.GetConnectedNodesResponse; -import com.google.android.gms.wearable.internal.GetDataItemResponse; -import com.google.android.gms.wearable.internal.GetFdForAssetResponse; -import com.google.android.gms.wearable.internal.GetLocalNodeResponse; -import com.google.android.gms.wearable.internal.IWearableCallbacks; -import com.google.android.gms.wearable.internal.OpenChannelResponse; -import com.google.android.gms.wearable.internal.PutDataResponse; -import com.google.android.gms.wearable.internal.RemoveLocalCapabilityResponse; -import com.google.android.gms.wearable.internal.SendMessageResponse; -import com.google.android.gms.wearable.internal.StorageInfoResponse; - -public class BaseWearableCallbacks extends IWearableCallbacks.Stub { - private static final String TAG = "GmsWearBaseCallback"; - - @Override - public void onGetConfigResponse(GetConfigResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onGetConfigResponse"); - - } - - @Override - public void onPutDataResponse(PutDataResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onPutDataResponse"); - - } - - @Override - public void onGetDataItemResponse(GetDataItemResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onGetDataItemResponse"); - - } - - @Override - public void onDataItemChanged(DataHolder dataHolder) throws RemoteException { - Log.d(TAG, "unimplemented Method: onDataItemChanged"); - - } - - @Override - public void onDeleteDataItemsResponse(DeleteDataItemsResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onDeleteDataItemsResponse"); - - } - - @Override - public void onSendMessageResponse(SendMessageResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onSendMessageResponse"); - - } - - @Override - public void onGetFdForAssetResponse(GetFdForAssetResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onGetFdForAssetResponse"); - - } - - @Override - public void onGetLocalNodeResponse(GetLocalNodeResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onGetLocalNodeResponse"); - - } - - @Override - public void onGetConnectedNodesResponse(GetConnectedNodesResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onGetConnectedNodesResponse"); - - } - - @Override - public void onOpenChannelResponse(OpenChannelResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onOpenChannelResponse"); - - } - - @Override - public void onCloseChannelResponse(CloseChannelResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onCloseChannelResponse"); - - } - - @Override - public void onGetChannelInputStreamResponse(GetChannelInputStreamResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onGetChannelInputStreamResponse"); - - } - - @Override - public void onGetChannelOutputStreamResponse(GetChannelOutputStreamResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onGetChannelOutputStreamResponse"); - - } - - @Override - public void onChannelReceiveFileResponse(ChannelReceiveFileResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onChannelReceiveFileResponse"); - - } - - @Override - public void onChannelSendFileResponse(ChannelSendFileResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onChannelSendFileResponse"); - - } - - @Override - public void onStatus(Status status) throws RemoteException { - Log.d(TAG, "unimplemented Method: onStatus"); - - } - - @Override - public void onStorageInfoResponse(StorageInfoResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onStorageInfoResponse"); - - } - - @Override - public void onGetCapabilityResponse(GetCapabilityResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onGetCapabilityResponse"); - - } - - @Override - public void onGetAllCapabilitiesResponse(GetAllCapabilitiesResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onGetAllCapabilitiesResponse"); - - } - - @Override - public void onAddLocalCapabilityResponse(AddLocalCapabilityResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onAddLocalCapabilityResponse"); - - } - - @Override - public void onRemoveLocalCapabilityResponse(RemoveLocalCapabilityResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onRemoveLocalCapabilityResponse"); - - } - - @Override - public void onGetConfigsResponse(GetConfigsResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onGetConfigsResponse"); - - } - - @Override - public void onGetCloudSyncOptInOutDoneResponse(GetCloudSyncOptInOutDoneResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onGetCloudSyncOptInOutDoneResponse"); - - } - - @Override - public void onGetCloudSyncSettingResponse(GetCloudSyncSettingResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onGetCloudSyncSettingResponse"); - - } - - @Override - public void onGetCloudSyncOptInStatusResponse(GetCloudSyncOptInStatusResponse response) throws RemoteException { - Log.d(TAG, "unimplemented Method: onGetCloudSyncOptInStatusResponse"); - - } -} diff --git a/play-services-wearable/src/main/java/org/microg/gms/wearable/ChannelImpl.java b/play-services-wearable/src/main/java/org/microg/gms/wearable/ChannelImpl.java deleted file mode 100644 index ddf4fff5..00000000 --- a/play-services-wearable/src/main/java/org/microg/gms/wearable/ChannelImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import android.net.Uri; -import android.util.Log; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.PendingResult; -import com.google.android.gms.common.api.Status; -import com.google.android.gms.wearable.Channel; -import com.google.android.gms.wearable.ChannelApi; -import com.google.android.gms.wearable.internal.ChannelParcelable; - -public class ChannelImpl extends ChannelParcelable implements Channel { - private static final String TAG = "GmsWearChannelImpl"; - - public ChannelImpl(String token, String nodeId, String path) { - super(token, nodeId, path); - } - - public ChannelImpl(ChannelParcelable wrapped) { - this(wrapped.token, wrapped.nodeId, wrapped.path); - } - - - @Override - public PendingResult addListener(GoogleApiClient client, ChannelApi.ChannelListener listener) { - Log.d(TAG, "unimplemented Method: addListener"); - return null; - } - - @Override - public PendingResult close(GoogleApiClient client, int errorCode) { - Log.d(TAG, "unimplemented Method: close"); - return null; - } - - @Override - public PendingResult close(GoogleApiClient client) { - Log.d(TAG, "unimplemented Method: close"); - return null; - } - - @Override - public PendingResult getInputStream(GoogleApiClient client) { - Log.d(TAG, "unimplemented Method: getInputStream"); - return null; - } - - @Override - public PendingResult getOutputStream(GoogleApiClient client) { - Log.d(TAG, "unimplemented Method: getOutputStream"); - return null; - } - - public String getNodeId() { - return nodeId; - } - - @Override - public String getPath() { - return path; - } - - public String getToken() { - return token; - } - - @Override - public PendingResult receiveFile(GoogleApiClient client, Uri uri, boolean append) { - Log.d(TAG, "unimplemented Method: receiveFile"); - return null; - } - - @Override - public PendingResult removeListener(GoogleApiClient client, ChannelApi.ChannelListener listener) { - Log.d(TAG, "unimplemented Method: removeListener"); - return null; - } - - @Override - public PendingResult sendFile(GoogleApiClient client, Uri uri) { - Log.d(TAG, "unimplemented Method: sendFile"); - return null; - } - - @Override - public PendingResult sendFile(GoogleApiClient client, Uri uri, long startOffset, long length) { - Log.d(TAG, "unimplemented Method: sendFile"); - return null; - } -} diff --git a/play-services-wearable/src/main/java/org/microg/gms/wearable/DataApiImpl.java b/play-services-wearable/src/main/java/org/microg/gms/wearable/DataApiImpl.java deleted file mode 100644 index 25b9c835..00000000 --- a/play-services-wearable/src/main/java/org/microg/gms/wearable/DataApiImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import android.net.Uri; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.PendingResult; -import com.google.android.gms.common.api.Status; -import com.google.android.gms.wearable.Asset; -import com.google.android.gms.wearable.DataApi; -import com.google.android.gms.wearable.DataItemAsset; -import com.google.android.gms.wearable.DataItemBuffer; -import com.google.android.gms.wearable.internal.PutDataRequest; - -public class DataApiImpl implements DataApi { - @Override - public PendingResult addListener(GoogleApiClient client, DataListener listener) { - throw new UnsupportedOperationException(); - } - - @Override - public PendingResult deleteDataItems(GoogleApiClient client, Uri uri) { - throw new UnsupportedOperationException(); - } - - @Override - public PendingResult getDataItem(GoogleApiClient client, Uri uri) { - throw new UnsupportedOperationException(); - } - - @Override - public PendingResult getDataItems(GoogleApiClient client) { - throw new UnsupportedOperationException(); - } - - @Override - public PendingResult getDataItems(GoogleApiClient client, Uri uri) { - throw new UnsupportedOperationException(); - } - - @Override - public PendingResult getFdForAsset(GoogleApiClient client, DataItemAsset asset) { - throw new UnsupportedOperationException(); - } - - @Override - public PendingResult getFdForAsset(GoogleApiClient client, Asset asset) { - throw new UnsupportedOperationException(); - } - - @Override - public PendingResult putDataItem(GoogleApiClient client, PutDataRequest request) { - throw new UnsupportedOperationException(); - } - - @Override - public PendingResult removeListener(GoogleApiClient client, DataListener listener) { - throw new UnsupportedOperationException(); - } -} diff --git a/play-services-wearable/src/main/java/org/microg/gms/wearable/MessageApiImpl.java b/play-services-wearable/src/main/java/org/microg/gms/wearable/MessageApiImpl.java deleted file mode 100644 index 7f9d5fc1..00000000 --- a/play-services-wearable/src/main/java/org/microg/gms/wearable/MessageApiImpl.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import android.os.RemoteException; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.PendingResult; -import com.google.android.gms.common.api.Status; -import com.google.android.gms.wearable.MessageApi; -import com.google.android.gms.wearable.Wearable; -import com.google.android.gms.wearable.internal.SendMessageResponse; - -import org.microg.gms.common.GmsConnector; - -public class MessageApiImpl implements MessageApi { - @Override - public PendingResult addListener(GoogleApiClient client, MessageListener listener) { - throw new UnsupportedOperationException(); - } - - @Override - public PendingResult removeListener(GoogleApiClient client, MessageListener listener) { - throw new UnsupportedOperationException(); - } - - @Override - public PendingResult sendMessage(GoogleApiClient client, final String nodeId, final String path, final byte[] data) { - return GmsConnector.call(client, Wearable.API, new GmsConnector.Callback() { - @Override - public void onClientAvailable(WearableClientImpl client, final ResultProvider resultProvider) throws RemoteException { - client.getServiceInterface().sendMessage(new BaseWearableCallbacks() { - @Override - public void onSendMessageResponse(SendMessageResponse response) throws RemoteException { - resultProvider.onResultAvailable(new SendMessageResultImpl(response)); - } - }, nodeId, path, data); - } - }); - } - - public static class SendMessageResultImpl implements SendMessageResult { - private SendMessageResponse response; - - public SendMessageResultImpl(SendMessageResponse response) { - this.response = response; - } - - @Override - public int getRequestId() { - return response.requestId; - } - - @Override - public Status getStatus() { - return new Status(response.statusCode); - } - } -} diff --git a/play-services-wearable/src/main/java/org/microg/gms/wearable/NodeApiImpl.java b/play-services-wearable/src/main/java/org/microg/gms/wearable/NodeApiImpl.java deleted file mode 100644 index 197b6e81..00000000 --- a/play-services-wearable/src/main/java/org/microg/gms/wearable/NodeApiImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.PendingResult; -import com.google.android.gms.common.api.Status; -import com.google.android.gms.wearable.NodeApi; - -public class NodeApiImpl implements NodeApi { - @Override - public PendingResult addListener(GoogleApiClient client, NodeListener listener) { - throw new UnsupportedOperationException(); - } - - @Override - public PendingResult getConnectedNodes(GoogleApiClient client) { - throw new UnsupportedOperationException(); - } - - @Override - public PendingResult getLocalNode(GoogleApiClient client) { - throw new UnsupportedOperationException(); - } - - @Override - public PendingResult removeListener(GoogleApiClient client, NodeListener listener) { - throw new UnsupportedOperationException(); - } -} diff --git a/play-services-wearable/src/main/java/org/microg/gms/wearable/WearableApiBuilder.java b/play-services-wearable/src/main/java/org/microg/gms/wearable/WearableApiBuilder.java deleted file mode 100644 index 3c20481b..00000000 --- a/play-services-wearable/src/main/java/org/microg/gms/wearable/WearableApiBuilder.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import android.content.Context; -import android.os.Looper; - -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 { - 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) { - return new WearableClientImpl(context, options, callbacks, connectionFailedListener); - } -} diff --git a/play-services-wearable/src/main/java/org/microg/gms/wearable/WearableClientImpl.java b/play-services-wearable/src/main/java/org/microg/gms/wearable/WearableClientImpl.java deleted file mode 100644 index 5a667f58..00000000 --- a/play-services-wearable/src/main/java/org/microg/gms/wearable/WearableClientImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable; - -import android.content.Context; -import android.os.IBinder; -import android.util.Log; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.wearable.Wearable; -import com.google.android.gms.wearable.internal.IWearableService; - -import org.microg.gms.common.GmsClient; -import org.microg.gms.common.GmsService; -import org.microg.gms.common.api.GoogleApiClientImpl; - -public class WearableClientImpl extends GmsClient { - private static final String TAG = "GmsWearClient"; - - public WearableClientImpl(Context context, Wearable.WearableOptions options, GoogleApiClient.ConnectionCallbacks callbacks, GoogleApiClient.OnConnectionFailedListener connectionFailedListener) { - super(context, callbacks, connectionFailedListener, GmsService.WEARABLE.ACTION); - serviceId = GmsService.WEARABLE.SERVICE_ID; - if (options != null && options.firstPartyMode) - extras.putBoolean("firstPartyMode", true); - Log.d(TAG, ""); - } - - @Override - protected IWearableService interfaceFromBinder(IBinder binder) { - return IWearableService.Stub.asInterface(binder); - } - - public static WearableClientImpl get(GoogleApiClient apiClient) { - if (apiClient instanceof GoogleApiClientImpl) { - return (WearableClientImpl) ((GoogleApiClientImpl) apiClient).getApiConnection(Wearable.API); - } - return null; - } -} diff --git a/play-services-wearable/src/main/java/org/microg/gms/wearable/databundle/DataBundleUtil.java b/play-services-wearable/src/main/java/org/microg/gms/wearable/databundle/DataBundleUtil.java deleted file mode 100644 index 10975f9d..00000000 --- a/play-services-wearable/src/main/java/org/microg/gms/wearable/databundle/DataBundleUtil.java +++ /dev/null @@ -1,658 +0,0 @@ -/* - * Copyright (C) 2013-2017 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.wearable.databundle; - -import android.util.SparseArray; - -import com.google.android.gms.wearable.Asset; -import com.google.android.gms.wearable.DataMap; -import com.squareup.wire.Wire; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import okio.ByteString; - -public class DataBundleUtil { - - public static DataMap readDataMap(byte[] bytes, List assets) { - try { - return readDataMap(new Wire().parseFrom(bytes, DataBundle.class), assets); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public static DataMap readDataMap(DataBundle dataBundle, List assets) { - return readDataMap(dataBundle.entries, assets); - } - - public static DataMap readDataMap(List entries, List assets) { - DataMap dataMap = new DataMap(); - for (DataBundleEntry entry : entries) { - readAndStore(dataMap, entry.key, entry.typedValue, assets); - } - return dataMap; - } - - public static byte[] createBytes(DataMap dataMap) { - AssetAnnotatedDataBundle dataBundle = createDataBundle(dataMap); - if (!dataBundle.getAssets().isEmpty()) { - throw new UnsupportedOperationException(); - } - return dataBundle.getData(); - } - - public static AssetAnnotatedDataBundle createDataBundle(DataMap dataMap) { - AssetAnnotatedDataBundle dataBundle = new AssetAnnotatedDataBundle(); - dataBundle.assets = new ArrayList(); - dataBundle.dataBundle = new DataBundle(createEntryList(dataMap, dataBundle.assets)); - return dataBundle; - } - - private static List createEntryList(DataMap dataMap, List assets) { - List entries = new ArrayList(); - for (String key : dataMap.keySet()) { - entries.add(getTypeHelper(dataMap.getType(key)).loadAndCreateEntry(dataMap, key, assets)); - } - return entries; - } - - private static void readAndStore(DataMap dataMap, String key, DataBundleTypedValue value, List assets) { - if (value.type == null) return; - getTypeHelper(value.type).readAndStore(dataMap, key, value, assets); - } - - - private static SparseArray typeHelperByCode; - - private static void rememberTypeReader(TypeHelper typeHelper) { - typeHelperByCode.put(typeHelper.type, typeHelper); - } - - static TypeHelper getTypeHelper(int type) { - if (typeHelperByCode.get(type) != null) { - return typeHelperByCode.get(type); - } else { - throw new IllegalArgumentException(); - } - } - - static TypeHelper getTypeHelper(DataMap.StoredType type) { - return getTypeHelper(type.getTypeCode()); - } - - static TypeHelper getListInnerTypeHelper(DataMap.StoredType type) { - return getTypeHelper(type.getListType()); - } - - public static final int BYTE_ARRAY_TYPE_CODE = 1; - static TypeHelper BYTEARRAY = new TypeHelper(BYTE_ARRAY_TYPE_CODE) { - @Override - byte[] read(DataBundleValue value, List assets) { - return value.byteArray.toByteArray(); - } - - @Override - DataBundleValue create(byte[] value, List assets) { - return new DataBundleValue.Builder().byteArray(ByteString.of(value)).build(); - } - - @Override - void store(DataMap dataMap, String key, byte[] value) { - dataMap.putByteArray(key, value); - } - - @Override - byte[] load(DataMap dataMap, String key) { - return dataMap.getByteArray(key); - } - }; - - public static final int STRING_TYPE_CODE = 2; - static TypeHelper STRING = new TypeHelper(STRING_TYPE_CODE) { - @Override - String read(DataBundleValue value, List assets) { - return value.stringVal; - } - - @Override - DataBundleValue create(String value, List assets) { - return new DataBundleValue.Builder().stringVal(value).build(); - } - - @Override - void store(DataMap dataMap, String key, String value) { - if (value != null) dataMap.putString(key, value); - } - - @Override - void storeList(DataMap dataMap, String key, ArrayList valueList) { - dataMap.putStringArrayList(key, valueList); - } - - @Override - String load(DataMap dataMap, String key) { - return dataMap.getString(key); - } - - @Override - AnnotatedArrayList loadList(DataMap dataMap, String key) { - AnnotatedArrayList list = new AnnotatedArrayList(this); - list.addAll(dataMap.getStringArrayList(key)); - return list; - } - }; - - public static final int DOUBLE_TYPE_CODE = 3; - static TypeHelper DOUBLE = new TypeHelper(DOUBLE_TYPE_CODE) { - @Override - Double read(DataBundleValue value, List assets) { - return value.doubleVal; - } - - @Override - DataBundleValue create(Double value, List assets) { - return new DataBundleValue.Builder().doubleVal(value).build(); - } - - @Override - void store(DataMap dataMap, String key, Double value) { - if (value != null) dataMap.putDouble(key, value); - } - - @Override - Double load(DataMap dataMap, String key) { - return dataMap.getDouble(key); - } - }; - - public static final int FLOAT_TYPE_CODE = 4; - static TypeHelper FLOAT = new TypeHelper(FLOAT_TYPE_CODE) { - @Override - Float read(DataBundleValue value, List assets) { - return value.floatVal; - } - - @Override - DataBundleValue create(Float value, List assets) { - return new DataBundleValue.Builder().floatVal(value).build(); - } - - @Override - void store(DataMap dataMap, String key, Float value) { - if (value != null) dataMap.putFloat(key, value); - } - - @Override - Float load(DataMap dataMap, String key) { - return dataMap.getFloat(key); - } - }; - - public static final int LONG_TYPE_CODE = 5; - static TypeHelper LONG = new TypeHelper(LONG_TYPE_CODE) { - @Override - Long read(DataBundleValue value, List assets) { - return value.longVal; - } - - @Override - DataBundleValue create(Long value, List assets) { - return new DataBundleValue.Builder().longVal(value).build(); - } - - @Override - void store(DataMap dataMap, String key, Long value) { - if (value != null) dataMap.putLong(key, value); - } - - @Override - Long load(DataMap dataMap, String key) { - return dataMap.getLong(key); - } - }; - - public static final int INTEGER_TYPE_CODE = 6; - static TypeHelper INTEGER = new TypeHelper(INTEGER_TYPE_CODE) { - @Override - Integer read(DataBundleValue value, List assets) { - return value.intVal; - } - - @Override - DataBundleValue create(Integer value, List assets) { - return new DataBundleValue.Builder().intVal(value).build(); - } - - @Override - void store(DataMap dataMap, String key, Integer value) { - if (value != null) dataMap.putInt(key, value); - } - - @Override - void storeList(DataMap dataMap, String key, ArrayList valueList) { - dataMap.putIntegerArrayList(key, valueList); - } - - @Override - Integer load(DataMap dataMap, String key) { - return dataMap.getInt(key); - } - - @Override - AnnotatedArrayList loadList(DataMap dataMap, String key) { - AnnotatedArrayList list = new AnnotatedArrayList(this); - list.addAll(dataMap.getIntegerArrayList(key)); - return list; - } - }; - - public static final int BYTE_TYPE_CODE = 7; - static TypeHelper BYTE = new TypeHelper(BYTE_TYPE_CODE) { - @Override - Byte read(DataBundleValue value, List assets) { - return (byte) (int) value.byteVal; - } - - @Override - DataBundleValue create(Byte value, List assets) { - return new DataBundleValue.Builder().byteVal((int) (byte) value).build(); - } - - @Override - void store(DataMap dataMap, String key, Byte value) { - if (value != null) dataMap.putByte(key, value); - } - - @Override - Byte load(DataMap dataMap, String key) { - return dataMap.getByte(key); - } - }; - - public static final int BOOLEAN_TYPE_CODE = 8; - static TypeHelper BOOLEAN = new TypeHelper(BOOLEAN_TYPE_CODE) { - @Override - Boolean read(DataBundleValue value, List assets) { - return value.booleanVal; - } - - @Override - DataBundleValue create(Boolean value, List assets) { - return new DataBundleValue.Builder().booleanVal(value).build(); - } - - @Override - void store(DataMap dataMap, String key, Boolean value) { - if (value != null) dataMap.putBoolean(key, value); - } - - @Override - Boolean load(DataMap dataMap, String key) { - return dataMap.getBoolean(key); - } - }; - - public static final int DATAMAP_TYPE_CODE = 9; - static TypeHelper DATAMAP = new TypeHelper(DATAMAP_TYPE_CODE) { - @Override - DataMap read(DataBundleValue value, List assets) { - return readDataMap(value.map, assets); - } - - @Override - DataBundleValue create(DataMap value, List assets) { - return new DataBundleValue.Builder().map(createEntryList(value, assets)).build(); - } - - @Override - void store(DataMap dataMap, String key, DataMap value) { - dataMap.putDataMap(key, value); - } - - @Override - void storeList(DataMap dataMap, String key, ArrayList valueList) { - dataMap.putDataMapArrayList(key, valueList); - } - - @Override - DataMap load(DataMap dataMap, String key) { - return dataMap.getDataMap(key); - } - - @Override - AnnotatedArrayList loadList(DataMap dataMap, String key) { - AnnotatedArrayList list = new AnnotatedArrayList(this); - list.addAll(dataMap.getDataMapArrayList(key)); - return list; - } - }; - - public static final int LIST_TYPE_CODE = 10; - static TypeHelper> ARRAYLIST = new TypeHelper>(LIST_TYPE_CODE) { - @Override - AnnotatedArrayList read(DataBundleValue value, List assets) { - TypeHelper innerTypeHelper = NULL; - for (DataBundleTypedValue typedValue : value.list) { - if (innerTypeHelper == NULL) { - innerTypeHelper = getTypeHelper(typedValue.type); - } else if (typedValue.type != innerTypeHelper.type && typedValue.type != NULL.type) { - throw new IllegalArgumentException("List has elements of different types: " + innerTypeHelper.type + " and " + typedValue.type); - } - } - return innerTypeHelper.readList(value.list, assets); - } - - @Override - DataBundleValue create(AnnotatedArrayList value, List assets) { - return new DataBundleValue.Builder().list(value.createList(assets)).build(); - } - - @Override - void store(DataMap dataMap, String key, AnnotatedArrayList value) { - value.store(dataMap, key); - } - - @Override - AnnotatedArrayList load(DataMap dataMap, String key) { - return getListInnerTypeHelper(dataMap.getType(key)).loadList(dataMap, key); - } - }; - - public static final int STRING_ARRAY_TYPE_CODE = 11; - static TypeHelper STRINGARRAY = new TypeHelper(STRING_ARRAY_TYPE_CODE) { - @Override - String[] read(DataBundleValue value, List assets) { - return value.stringArray.toArray(new String[value.stringArray.size()]); - } - - @Override - DataBundleValue create(String[] value, List assets) { - return new DataBundleValue.Builder().stringArray(Arrays.asList(value)).build(); - } - - @Override - void store(DataMap dataMap, String key, String[] value) { - dataMap.putStringArray(key, value); - } - - @Override - String[] load(DataMap dataMap, String key) { - return dataMap.getStringArray(key); - } - }; - - public static final int LONG_ARRAY_TYPE_CODE = 12; - static TypeHelper LONGARRAY = new TypeHelper(LONG_ARRAY_TYPE_CODE) { - @Override - long[] read(DataBundleValue value, List assets) { - long[] longArr = new long[value.longArray.size()]; - for (int i = 0; i < value.longArray.size(); i++) { - longArr[i] = value.longArray.get(i); - } - return longArr; - } - - @Override - DataBundleValue create(long[] value, List assets) { - List longList = new ArrayList(value.length); - for (long l : value) { - longList.add(l); - } - return new DataBundleValue.Builder().longArray(longList).build(); - } - - @Override - void store(DataMap dataMap, String key, long[] value) { - dataMap.putLongArray(key, value); - } - - @Override - long[] load(DataMap dataMap, String key) { - return dataMap.getLongArray(key); - } - }; - - public static final int ASSET_TYPE_CODE = 13; - static TypeHelper ASSET = new TypeHelper(ASSET_TYPE_CODE) { - @Override - Asset read(DataBundleValue value, List assets) { - return assets.get(value.assetIndex); - } - - @Override - DataBundleValue create(Asset value, List assets) { - int index; - if (assets.contains(value)) { - index = assets.indexOf(value); - } else { - index = assets.size(); - assets.add(value); - } - return new DataBundleValue.Builder().assetIndex(index).build(); - } - - @Override - void store(DataMap dataMap, String key, Asset value) { - dataMap.putAsset(key, value); - } - - @Override - Asset load(DataMap dataMap, String key) { - return dataMap.getAsset(key); - } - }; - - public static final int NULL_TYPE_CODE = 14; - static TypeHelper NULL = new TypeHelper(NULL_TYPE_CODE) { - @Override - String read(DataBundleValue value, List assets) { - return null; - } - - @Override - DataBundleValue create(String value, List assets) { - return new DataBundleValue.Builder().build(); - } - - @Override - void store(DataMap dataMap, String key, String value) { - dataMap.putString(key, value); - } - - @Override - void storeList(DataMap dataMap, String key, ArrayList valueList) { - dataMap.putStringArrayList(key, valueList); - } - - @Override - String load(DataMap dataMap, String key) { - return null; - } - - @Override - AnnotatedArrayList loadList(DataMap dataMap, String key) { - AnnotatedArrayList list = new AnnotatedArrayList(this); - list.addAll(dataMap.getStringArrayList(key)); - return list; - } - }; - - public static final int FLOAT_ARRAY_TYPE_CODE = 15; - static TypeHelper FLOATARRAY = new TypeHelper(FLOAT_ARRAY_TYPE_CODE) { - @Override - float[] read(DataBundleValue value, List assets) { - float[] floatArr = new float[value.floatArray.size()]; - for (int i = 0; i < value.floatArray.size(); i++) { - floatArr[i] = value.floatArray.get(i); - } - return floatArr; - } - - @Override - DataBundleValue create(float[] value, List assets) { - List floatList = new ArrayList(value.length); - for (float f : value) { - floatList.add(f); - } - return new DataBundleValue.Builder().floatArray(floatList).build(); - } - - @Override - void store(DataMap dataMap, String key, float[] value) { - dataMap.putFloatArray(key, value); - } - - @Override - float[] load(DataMap dataMap, String key) { - return dataMap.getFloatArray(key); - } - }; - - static { - typeHelperByCode = new SparseArray(); - rememberTypeReader(BYTEARRAY); - rememberTypeReader(STRING); - rememberTypeReader(DOUBLE); - rememberTypeReader(FLOAT); - rememberTypeReader(LONG); - rememberTypeReader(INTEGER); - rememberTypeReader(BYTE); - rememberTypeReader(BOOLEAN); - rememberTypeReader(DATAMAP); - rememberTypeReader(ARRAYLIST); - rememberTypeReader(STRINGARRAY); - rememberTypeReader(LONGARRAY); - rememberTypeReader(ASSET); - rememberTypeReader(NULL); - rememberTypeReader(FLOATARRAY); - } - - static class AssetAnnotatedDataBundle { - private DataBundle dataBundle; - private List assets; - - public List getAssets() { - return assets; - } - - public byte[] getData() { - return dataBundle.toByteArray(); - } - } - - static class AnnotatedArrayList extends ArrayList { - private TypeHelper innerType; - - public AnnotatedArrayList(TypeHelper innerType) { - this.innerType = innerType; - } - - void store(DataMap dataMap, String key) { - innerType.storeList(dataMap, key, this); - } - - public List createList(List assets) { - return innerType.createList(this, assets); - } - } - - static abstract class TypeHelper { - private int type; - - public TypeHelper(int type) { - this.type = type; - } - - abstract T read(DataBundleValue value, List assets); - - abstract DataBundleValue create(T value, List assets); - - T read(DataBundleTypedValue value, List assets) { - if (value.type == NULL_TYPE_CODE) { - return null; - } else if (value.type == type) { - return read(value.value, assets); - } else { - throw new IllegalArgumentException(); - } - } - - abstract void store(DataMap dataMap, String key, T value); - - void storeList(DataMap dataMap, String key, ArrayList valueList) { - throw new UnsupportedOperationException(); - } - - abstract T load(DataMap dataMap, String key); - - AnnotatedArrayList loadList(DataMap dataMap, String key) { - throw new UnsupportedOperationException(); - } - - void readAndStore(DataMap dataMap, String key, DataBundleValue value, List assets) { - store(dataMap, key, read(value, assets)); - } - - void readAndStore(DataMap dataMap, String key, DataBundleTypedValue value, List assets) { - store(dataMap, key, read(value, assets)); - } - - void readAndStore(DataMap dataMap, DataBundleEntry entry, List assets) { - readAndStore(dataMap, entry.key, entry.typedValue, assets); - } - - AnnotatedArrayList readList(List values, List assets) { - AnnotatedArrayList list = new AnnotatedArrayList(this); - for (DataBundleTypedValue value : values) { - list.add(read(value, assets)); - } - return list; - } - - List createList(AnnotatedArrayList value, List assets) { - List list = new ArrayList(); - for (T val : value) { - list.add(createTyped(val, assets)); - } - return list; - } - - void readAndStore(DataMap dataMap, String key, List values, List assets) { - storeList(dataMap, key, readList(values, assets)); - } - - DataBundleTypedValue createTyped(T value, List assets) { - return new DataBundleTypedValue(type, create(value, assets)); - } - - DataBundleValue loadAndCreate(DataMap dataMap, String key, List assets) { - return create(load(dataMap, key), assets); - } - - DataBundleTypedValue loadAndCreateTyped(DataMap dataMap, String key, List assets) { - return createTyped(load(dataMap, key), assets); - } - - DataBundleEntry loadAndCreateEntry(DataMap dataMap, String key, List assets) { - return new DataBundleEntry(key, loadAndCreateTyped(dataMap, key, assets)); - } - } -} diff --git a/play-services-wearable/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundle.java b/play-services-wearable/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundle.java deleted file mode 100644 index ba388652..00000000 --- a/play-services-wearable/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundle.java +++ /dev/null @@ -1,64 +0,0 @@ -// Code generated by Wire protocol buffer compiler, do not edit. -// Source file: protos-repo/databundle.proto -package org.microg.gms.wearable.databundle; - -import com.squareup.wire.Message; -import com.squareup.wire.ProtoField; -import java.util.Collections; -import java.util.List; - -import static com.squareup.wire.Message.Label.REPEATED; - -public final class DataBundle extends Message { - - public static final List DEFAULT_ENTRIES = Collections.emptyList(); - - @ProtoField(tag = 1, label = REPEATED, messageType = DataBundleEntry.class) - public final List entries; - - public DataBundle(List entries) { - this.entries = immutableCopyOf(entries); - } - - private DataBundle(Builder builder) { - this(builder.entries); - setBuilder(builder); - } - - @Override - public boolean equals(Object other) { - if (other == this) return true; - if (!(other instanceof DataBundle)) return false; - return equals(entries, ((DataBundle) other).entries); - } - - @Override - public int hashCode() { - int result = hashCode; - return result != 0 ? result : (hashCode = entries != null ? entries.hashCode() : 1); - } - - public static final class Builder extends Message.Builder { - - public List entries; - - public Builder() { - } - - public Builder(DataBundle message) { - super(message); - if (message == null) return; - this.entries = copyOf(message.entries); - } - - public Builder entries(List entries) { - this.entries = checkForNulls(entries); - return this; - } - - @Override - public DataBundle build() { - return new DataBundle(this); - } - } -} diff --git a/play-services-wearable/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundleEntry.java b/play-services-wearable/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundleEntry.java deleted file mode 100644 index a5f52d38..00000000 --- a/play-services-wearable/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundleEntry.java +++ /dev/null @@ -1,80 +0,0 @@ -// Code generated by Wire protocol buffer compiler, do not edit. -// Source file: protos-repo/databundle.proto -package org.microg.gms.wearable.databundle; - -import com.squareup.wire.Message; -import com.squareup.wire.ProtoField; - -import static com.squareup.wire.Message.Datatype.STRING; - -public final class DataBundleEntry extends Message { - - public static final String DEFAULT_KEY = ""; - - @ProtoField(tag = 1, type = STRING) - public final String key; - - @ProtoField(tag = 2) - public final DataBundleTypedValue typedValue; - - public DataBundleEntry(String key, DataBundleTypedValue typedValue) { - this.key = key; - this.typedValue = typedValue; - } - - private DataBundleEntry(Builder builder) { - this(builder.key, builder.typedValue); - setBuilder(builder); - } - - @Override - public boolean equals(Object other) { - if (other == this) return true; - if (!(other instanceof DataBundleEntry)) return false; - DataBundleEntry o = (DataBundleEntry) other; - return equals(key, o.key) - && equals(typedValue, o.typedValue); - } - - @Override - public int hashCode() { - int result = hashCode; - if (result == 0) { - result = key != null ? key.hashCode() : 0; - result = result * 37 + (typedValue != null ? typedValue.hashCode() : 0); - hashCode = result; - } - return result; - } - - public static final class Builder extends Message.Builder { - - public String key; - public DataBundleTypedValue typedValue; - - public Builder() { - } - - public Builder(DataBundleEntry message) { - super(message); - if (message == null) return; - this.key = message.key; - this.typedValue = message.typedValue; - } - - public Builder key(String key) { - this.key = key; - return this; - } - - public Builder typedValue(DataBundleTypedValue typedValue) { - this.typedValue = typedValue; - return this; - } - - @Override - public DataBundleEntry build() { - return new DataBundleEntry(this); - } - } -} diff --git a/play-services-wearable/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundleTypedValue.java b/play-services-wearable/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundleTypedValue.java deleted file mode 100644 index 9a7d08f6..00000000 --- a/play-services-wearable/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundleTypedValue.java +++ /dev/null @@ -1,80 +0,0 @@ -// Code generated by Wire protocol buffer compiler, do not edit. -// Source file: protos-repo/databundle.proto -package org.microg.gms.wearable.databundle; - -import com.squareup.wire.Message; -import com.squareup.wire.ProtoField; - -import static com.squareup.wire.Message.Datatype.INT32; - -public final class DataBundleTypedValue extends Message { - - public static final Integer DEFAULT_TYPE = 0; - - @ProtoField(tag = 1, type = INT32) - public final Integer type; - - @ProtoField(tag = 2) - public final DataBundleValue value; - - public DataBundleTypedValue(Integer type, DataBundleValue value) { - this.type = type; - this.value = value; - } - - private DataBundleTypedValue(Builder builder) { - this(builder.type, builder.value); - setBuilder(builder); - } - - @Override - public boolean equals(Object other) { - if (other == this) return true; - if (!(other instanceof DataBundleTypedValue)) return false; - DataBundleTypedValue o = (DataBundleTypedValue) other; - return equals(type, o.type) - && equals(value, o.value); - } - - @Override - public int hashCode() { - int result = hashCode; - if (result == 0) { - result = type != null ? type.hashCode() : 0; - result = result * 37 + (value != null ? value.hashCode() : 0); - hashCode = result; - } - return result; - } - - public static final class Builder extends Message.Builder { - - public Integer type; - public DataBundleValue value; - - public Builder() { - } - - public Builder(DataBundleTypedValue message) { - super(message); - if (message == null) return; - this.type = message.type; - this.value = message.value; - } - - public Builder type(Integer type) { - this.type = type; - return this; - } - - public Builder value(DataBundleValue value) { - this.value = value; - return this; - } - - @Override - public DataBundleTypedValue build() { - return new DataBundleTypedValue(this); - } - } -} diff --git a/play-services-wearable/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundleValue.java b/play-services-wearable/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundleValue.java deleted file mode 100644 index 4b9a120a..00000000 --- a/play-services-wearable/src/main/protos-java/org/microg/gms/wearable/databundle/DataBundleValue.java +++ /dev/null @@ -1,259 +0,0 @@ -// Code generated by Wire protocol buffer compiler, do not edit. -// Source file: protos-repo/databundle.proto -package org.microg.gms.wearable.databundle; - -import com.squareup.wire.Message; -import com.squareup.wire.ProtoField; -import java.util.Collections; -import java.util.List; -import okio.ByteString; - -import static com.squareup.wire.Message.Datatype.BOOL; -import static com.squareup.wire.Message.Datatype.BYTES; -import static com.squareup.wire.Message.Datatype.DOUBLE; -import static com.squareup.wire.Message.Datatype.FLOAT; -import static com.squareup.wire.Message.Datatype.INT32; -import static com.squareup.wire.Message.Datatype.INT64; -import static com.squareup.wire.Message.Datatype.STRING; -import static com.squareup.wire.Message.Label.REPEATED; - -public final class DataBundleValue extends Message { - - public static final ByteString DEFAULT_BYTEARRAY = ByteString.EMPTY; - public static final String DEFAULT_STRINGVAL = ""; - public static final Double DEFAULT_DOUBLEVAL = 0D; - public static final Float DEFAULT_FLOATVAL = 0F; - public static final Long DEFAULT_LONGVAL = 0L; - public static final Integer DEFAULT_INTVAL = 0; - public static final Integer DEFAULT_BYTEVAL = 0; - public static final Boolean DEFAULT_BOOLEANVAL = false; - public static final List DEFAULT_MAP = Collections.emptyList(); - public static final List DEFAULT_LIST = Collections.emptyList(); - public static final List DEFAULT_STRINGARRAY = Collections.emptyList(); - public static final List DEFAULT_LONGARRAY = Collections.emptyList(); - public static final Integer DEFAULT_ASSETINDEX = 0; - public static final List DEFAULT_FLOATARRAY = Collections.emptyList(); - - @ProtoField(tag = 1, type = BYTES) - public final ByteString byteArray; - - @ProtoField(tag = 2, type = STRING) - public final String stringVal; - - @ProtoField(tag = 3, type = DOUBLE) - public final Double doubleVal; - - @ProtoField(tag = 4, type = FLOAT) - public final Float floatVal; - - @ProtoField(tag = 5, type = INT64) - public final Long longVal; - - @ProtoField(tag = 6, type = INT32) - public final Integer intVal; - - @ProtoField(tag = 7, type = INT32) - public final Integer byteVal; - - @ProtoField(tag = 8, type = BOOL) - public final Boolean booleanVal; - - @ProtoField(tag = 9, label = REPEATED, messageType = DataBundleEntry.class) - public final List map; - - @ProtoField(tag = 10, label = REPEATED, messageType = DataBundleTypedValue.class) - public final List list; - - @ProtoField(tag = 11, type = STRING, label = REPEATED) - public final List stringArray; - - @ProtoField(tag = 12, type = INT64, label = REPEATED) - public final List longArray; - - @ProtoField(tag = 13, type = INT32) - public final Integer assetIndex; - - @ProtoField(tag = 14, type = FLOAT, label = REPEATED) - public final List floatArray; - - public DataBundleValue(ByteString byteArray, String stringVal, Double doubleVal, Float floatVal, Long longVal, Integer intVal, Integer byteVal, Boolean booleanVal, List map, List list, List stringArray, List longArray, Integer assetIndex, List floatArray) { - this.byteArray = byteArray; - this.stringVal = stringVal; - this.doubleVal = doubleVal; - this.floatVal = floatVal; - this.longVal = longVal; - this.intVal = intVal; - this.byteVal = byteVal; - this.booleanVal = booleanVal; - this.map = immutableCopyOf(map); - this.list = immutableCopyOf(list); - this.stringArray = immutableCopyOf(stringArray); - this.longArray = immutableCopyOf(longArray); - this.assetIndex = assetIndex; - this.floatArray = immutableCopyOf(floatArray); - } - - private DataBundleValue(Builder builder) { - this(builder.byteArray, builder.stringVal, builder.doubleVal, builder.floatVal, builder.longVal, builder.intVal, builder.byteVal, builder.booleanVal, builder.map, builder.list, builder.stringArray, builder.longArray, builder.assetIndex, builder.floatArray); - setBuilder(builder); - } - - @Override - public boolean equals(Object other) { - if (other == this) return true; - if (!(other instanceof DataBundleValue)) return false; - DataBundleValue o = (DataBundleValue) other; - return equals(byteArray, o.byteArray) - && equals(stringVal, o.stringVal) - && equals(doubleVal, o.doubleVal) - && equals(floatVal, o.floatVal) - && equals(longVal, o.longVal) - && equals(intVal, o.intVal) - && equals(byteVal, o.byteVal) - && equals(booleanVal, o.booleanVal) - && equals(map, o.map) - && equals(list, o.list) - && equals(stringArray, o.stringArray) - && equals(longArray, o.longArray) - && equals(assetIndex, o.assetIndex) - && equals(floatArray, o.floatArray); - } - - @Override - public int hashCode() { - int result = hashCode; - if (result == 0) { - result = byteArray != null ? byteArray.hashCode() : 0; - result = result * 37 + (stringVal != null ? stringVal.hashCode() : 0); - result = result * 37 + (doubleVal != null ? doubleVal.hashCode() : 0); - result = result * 37 + (floatVal != null ? floatVal.hashCode() : 0); - result = result * 37 + (longVal != null ? longVal.hashCode() : 0); - result = result * 37 + (intVal != null ? intVal.hashCode() : 0); - result = result * 37 + (byteVal != null ? byteVal.hashCode() : 0); - result = result * 37 + (booleanVal != null ? booleanVal.hashCode() : 0); - result = result * 37 + (map != null ? map.hashCode() : 1); - result = result * 37 + (list != null ? list.hashCode() : 1); - result = result * 37 + (stringArray != null ? stringArray.hashCode() : 1); - result = result * 37 + (longArray != null ? longArray.hashCode() : 1); - result = result * 37 + (assetIndex != null ? assetIndex.hashCode() : 0); - result = result * 37 + (floatArray != null ? floatArray.hashCode() : 1); - hashCode = result; - } - return result; - } - - public static final class Builder extends Message.Builder { - - public ByteString byteArray; - public String stringVal; - public Double doubleVal; - public Float floatVal; - public Long longVal; - public Integer intVal; - public Integer byteVal; - public Boolean booleanVal; - public List map; - public List list; - public List stringArray; - public List longArray; - public Integer assetIndex; - public List floatArray; - - public Builder() { - } - - public Builder(DataBundleValue message) { - super(message); - if (message == null) return; - this.byteArray = message.byteArray; - this.stringVal = message.stringVal; - this.doubleVal = message.doubleVal; - this.floatVal = message.floatVal; - this.longVal = message.longVal; - this.intVal = message.intVal; - this.byteVal = message.byteVal; - this.booleanVal = message.booleanVal; - this.map = copyOf(message.map); - this.list = copyOf(message.list); - this.stringArray = copyOf(message.stringArray); - this.longArray = copyOf(message.longArray); - this.assetIndex = message.assetIndex; - this.floatArray = copyOf(message.floatArray); - } - - public Builder byteArray(ByteString byteArray) { - this.byteArray = byteArray; - return this; - } - - public Builder stringVal(String stringVal) { - this.stringVal = stringVal; - return this; - } - - public Builder doubleVal(Double doubleVal) { - this.doubleVal = doubleVal; - return this; - } - - public Builder floatVal(Float floatVal) { - this.floatVal = floatVal; - return this; - } - - public Builder longVal(Long longVal) { - this.longVal = longVal; - return this; - } - - public Builder intVal(Integer intVal) { - this.intVal = intVal; - return this; - } - - public Builder byteVal(Integer byteVal) { - this.byteVal = byteVal; - return this; - } - - public Builder booleanVal(Boolean booleanVal) { - this.booleanVal = booleanVal; - return this; - } - - public Builder map(List map) { - this.map = checkForNulls(map); - return this; - } - - public Builder list(List list) { - this.list = checkForNulls(list); - return this; - } - - public Builder stringArray(List stringArray) { - this.stringArray = checkForNulls(stringArray); - return this; - } - - public Builder longArray(List longArray) { - this.longArray = checkForNulls(longArray); - return this; - } - - public Builder assetIndex(Integer assetIndex) { - this.assetIndex = assetIndex; - return this; - } - - public Builder floatArray(List floatArray) { - this.floatArray = checkForNulls(floatArray); - return this; - } - - @Override - public DataBundleValue build() { - return new DataBundleValue(this); - } - } -} diff --git a/play-services-wearable/src/main/protos-repo/databundle.proto b/play-services-wearable/src/main/protos-repo/databundle.proto deleted file mode 100644 index bc8cb317..00000000 --- a/play-services-wearable/src/main/protos-repo/databundle.proto +++ /dev/null @@ -1,33 +0,0 @@ -option java_package = "org.microg.gms.wearable.databundle"; -option java_outer_classname = "DataBundleProto"; - -message DataBundle { - repeated DataBundleEntry entries = 1; -} - -message DataBundleEntry { - optional string key = 1; - optional DataBundleTypedValue typedValue = 2; -} - -message DataBundleTypedValue { - optional int32 type = 1; - optional DataBundleValue value = 2; -} - -message DataBundleValue { - optional bytes byteArray = 1; - optional string stringVal = 2; - optional double doubleVal = 3; - optional float floatVal = 4; - optional int64 longVal = 5; - optional int32 intVal = 6; - optional int32 byteVal = 7; - optional bool booleanVal = 8; - repeated DataBundleEntry map = 9; - repeated DataBundleTypedValue list = 10; - repeated string stringArray = 11; - repeated int64 longArray = 12; - optional int32 assetIndex = 13; - repeated float floatArray = 14; -}