From f403715896fe106889e7bd7eaaf4466652382d1b Mon Sep 17 00:00:00 2001 From: Oizaro Date: Thu, 19 Nov 2020 15:56:44 +0100 Subject: [PATCH] MicroG 0.2.14.204215 --- README.md | 1 - build.gradle | 7 +- play-services-api/build.gradle | 1 + .../gms/appdatasearch/CorpusStatus.aidl | 3 + .../android/gms/appdatasearch/PIMEUpdate.aidl | 3 + .../gms/appdatasearch/PIMEUpdateResponse.aidl | 3 + .../RequestIndexingSpecification.aidl | 3 + .../appdatasearch/SuggestSpecification.aidl | 3 + .../gms/appdatasearch/SuggestionResults.aidl | 3 + .../android/gms/appdatasearch/UsageInfo.aidl | 3 + .../internal/IAppDataSearch.aidl | 14 + .../internal/ILightweightAppDataSearch.aidl | 8 + .../ILightweightAppDataSearchCallbacks.aidl | 4 + .../ISearchAdministrationService.aidl | 5 + .../search/corpora/ClearCorpusRequest.aidl | 3 + .../search/corpora/GetCorpusInfoRequest.aidl | 3 + .../corpora/GetCorpusStatusRequest.aidl | 3 + .../corpora/GetCorpusStatusResponse.aidl | 3 + .../corpora/RequestIndexingRequest.aidl | 3 + .../corpora/RequestIndexingResponse.aidl | 3 + .../internal/ISearchCorporaCallbacks.aidl | 9 + .../internal/ISearchCorporaService.aidl | 14 + .../GetCurrentExperimentIdsRequest.aidl | 3 + .../GetCurrentExperimentIdsResponse.aidl | 3 + .../global/GetGlobalSearchSourcesRequest.aidl | 3 + .../GetGlobalSearchSourcesResponse.aidl | 3 + .../GetPendingExperimentIdsRequest.aidl | 3 + .../GetPendingExperimentIdsResponse.aidl | 3 + .../global/SetExperimentIdsRequest.aidl | 3 + .../global/SetExperimentIdsResponse.aidl | 3 + .../SetIncludeInGlobalSearchRequest.aidl | 3 + .../SetIncludeInGlobalSearchResponse.aidl | 3 + .../internal/IGlobalSearchAdminCallbacks.aidl | 16 + .../internal/IGlobalSearchAdminService.aidl | 17 + .../gms/search/queries/QueryRequest.aidl | 3 + .../gms/search/queries/QueryResponse.aidl | 3 + .../internal/ISearchQueriesCallbacks.aidl | 7 + .../internal/ISearchQueriesService.aidl | 8 + .../gms/appdatasearch/CorpusStatus.java | 46 ++ .../android/gms/appdatasearch/PIMEUpdate.java | 24 + .../gms/appdatasearch/PIMEUpdateResponse.java | 42 ++ .../gms/appdatasearch/QuerySpecification.java | 72 +++ .../RequestIndexingSpecification.java | 28 ++ .../gms/appdatasearch/SearchResults.java | 27 ++ .../appdatasearch/SuggestSpecification.java | 31 ++ .../gms/appdatasearch/SuggestionResults.java | 54 +++ .../android/gms/appdatasearch/UsageInfo.java | 24 + .../search/corpora/ClearCorpusRequest.java | 23 + .../search/corpora/GetCorpusInfoRequest.java | 23 + .../corpora/GetCorpusStatusRequest.java | 48 ++ .../corpora/GetCorpusStatusResponse.java | 47 ++ .../corpora/RequestIndexingRequest.java | 53 +++ .../corpora/RequestIndexingResponse.java | 46 ++ .../GetCurrentExperimentIdsRequest.java | 28 ++ .../GetCurrentExperimentIdsResponse.java | 57 +++ .../global/GetGlobalSearchSourcesRequest.java | 39 ++ .../GetGlobalSearchSourcesResponse.java | 59 +++ .../GetPendingExperimentIdsRequest.java | 28 ++ .../GetPendingExperimentIdsResponse.java | 57 +++ .../global/SetExperimentIdsRequest.java | 45 ++ .../global/SetExperimentIdsResponse.java | 49 ++ .../SetIncludeInGlobalSearchRequest.java | 47 ++ .../SetIncludeInGlobalSearchResponse.java | 49 ++ .../gms/search/queries/QueryRequest.java | 57 +++ .../gms/search/queries/QueryResponse.java | 47 ++ play-services-base/build.gradle | 2 +- .../gms/common/MultiConnectionKeeper.java | 15 +- .../common/internal/IGmsServiceBroker.aidl | 2 + .../common/internal/GetServiceRequest.java | 2 + .../org/microg/gms/common/GmsService.java | 12 + play-services-core/build.gradle | 16 +- play-services-core/proguard-rules.pro | 2 + .../src/main/AndroidManifest.xml | 36 +- .../security/ProviderInstallerImpl.java | 280 ++++++----- .../gms/security/ProviderInstaller.java | 61 +++ .../chimera/container/DynamiteLoaderImpl.java | 74 +++ .../microg/gms/AbstractGmsServiceBroker.java | 14 + .../microg/gms/icing/AppDataSearchImpl.java | 64 +++ .../gms/icing/GlobalSearchAdminImpl.java | 77 +++ .../org/microg/gms/icing/IndexService.java | 66 +++ .../icing/LightweightAppDataSearchImpl.java | 42 ++ .../gms/icing/LightweightIndexService.java | 38 ++ .../microg/gms/icing/SearchCorporaImpl.java | 79 ++++ .../microg/gms/icing/SearchQueriesImpl.java | 44 ++ .../gms/location/GoogleLocationManager.java | 199 ++++++++ .../GoogleLocationManagerService.java | 39 ++ .../GoogleLocationManagerServiceImpl.java | 357 ++++++++++++++ .../gms/location/LocationChangeListener.java | 21 + .../gms/location/LocationRequestHelper.java | 216 +++++++++ .../gms/location/MockLocationProvider.java | 49 ++ .../gms/location/RealLocationProvider.java | 149 ++++++ .../gms/location/ReportingAndroidService.java | 38 ++ .../gms/location/ReportingServiceImpl.java | 61 +++ .../microg/gms/mdm/NetworkQualityService.java | 32 ++ .../src/main/res/values-it/strings.xml | 2 +- play-services-location-api/build.gradle | 39 ++ play-services-location-api/gradle.properties | 34 ++ .../src/main/AndroidManifest.xml | 18 + .../location/ActivityRecognitionResult.aidl | 3 + .../gms/location/GeofencingRequest.aidl | 3 + .../android/gms/location/GestureRequest.aidl | 3 + .../gms/location/ILocationCallback.aidl | 11 + .../gms/location/ILocationListener.aidl | 7 + .../gms/location/LocationAvailability.aidl | 3 + .../android/gms/location/LocationRequest.aidl | 3 + .../android/gms/location/LocationResult.aidl | 3 + .../gms/location/LocationSettingsRequest.aidl | 3 + .../gms/location/LocationSettingsResult.aidl | 3 + .../android/gms/location/LocationStatus.aidl | 3 + .../internal/FusedLocationProviderResult.aidl | 3 + .../IFusedLocationProviderCallback.aidl | 7 + .../internal/IGeofencerCallbacks.aidl | 9 + .../IGoogleLocationManagerService.aidl | 88 ++++ .../location/internal/ISettingsCallbacks.aidl | 7 + .../internal/LocationRequestInternal.aidl | 3 + .../internal/LocationRequestUpdateData.aidl | 3 + .../location/internal/ParcelableGeofence.aidl | 3 + .../location/places/AutocompleteFilter.aidl | 3 + .../location/places/NearbyAlertRequest.aidl | 3 + .../gms/location/places/PlaceFilter.aidl | 3 + .../gms/location/places/PlaceReport.aidl | 3 + .../gms/location/places/PlaceRequest.aidl | 3 + .../gms/location/places/UserAddedPlace.aidl | 3 + .../gms/location/places/UserDataType.aidl | 3 + .../places/internal/IPlacesCallbacks.aidl | 9 + .../places/internal/PlacesParams.aidl | 3 + .../location/reporting/ReportingState.aidl | 3 + .../gms/location/reporting/UploadRequest.aidl | 3 + .../reporting/UploadRequestResult.aidl | 3 + .../reporting/internal/IReportingService.aidl | 15 + .../google/android/gms/maps/model/LatLng.aidl | 3 + .../android/gms/maps/model/LatLngBounds.aidl | 3 + .../location/ActivityRecognitionResult.java | 192 ++++++++ .../gms/location/DetectedActivity.java | 166 +++++++ .../google/android/gms/location/Geofence.java | 172 +++++++ .../gms/location/GeofenceStatusCodes.java | 55 +++ .../android/gms/location/GeofencingEvent.java | 133 ++++++ .../gms/location/GeofencingRequest.java | 27 ++ .../android/gms/location/GestureRequest.java | 23 + .../gms/location/LocationAvailability.java | 137 ++++++ .../android/gms/location/LocationRequest.java | 439 ++++++++++++++++++ .../android/gms/location/LocationResult.java | 45 ++ .../gms/location/LocationSettingsRequest.java | 109 +++++ .../gms/location/LocationSettingsResult.java | 72 +++ .../gms/location/LocationSettingsStates.java | 92 ++++ .../location/LocationSettingsStatusCodes.java | 33 ++ .../android/gms/location/LocationStatus.java | 92 ++++ .../gms/location/internal/ClientIdentity.java | 23 + .../internal/FusedLocationProviderResult.java | 40 ++ .../internal/LocationRequestInternal.java | 78 ++++ .../internal/LocationRequestUpdateData.java | 67 +++ .../location/internal/ParcelableGeofence.java | 77 +++ .../location/places/AutocompleteFilter.java | 31 ++ .../location/places/NearbyAlertRequest.java | 27 ++ .../android/gms/location/places/Place.java | 384 +++++++++++++++ .../gms/location/places/PlaceFilter.java | 27 ++ .../gms/location/places/PlaceReport.java | 43 ++ .../gms/location/places/PlaceRequest.java | 26 ++ .../gms/location/places/UserAddedPlace.java | 31 ++ .../gms/location/places/UserDataType.java | 27 ++ .../location/places/internal/PlaceImpl.java | 145 ++++++ .../places/internal/PlacesParams.java | 40 ++ .../location/reporting/ReportingState.java | 43 ++ .../gms/location/reporting/UploadRequest.java | 41 ++ .../reporting/UploadRequestResult.java | 34 ++ .../google/android/gms/maps/model/LatLng.java | 104 +++++ .../android/gms/maps/model/LatLngBounds.java | 227 +++++++++ .../gms/location/LocationConstants.java | 33 ++ play-services-location/build.gradle | 40 ++ play-services-location/gradle.properties | 34 ++ .../src/main/AndroidManifest.xml | 24 + .../gms/location/ActivityRecognition.java | 40 ++ .../gms/location/ActivityRecognitionApi.java | 115 +++++ .../location/FusedLocationProviderApi.java | 54 +++ .../location/FusedLocationProviderClient.java | 42 ++ .../android/gms/location/GeofencingApi.java | 49 ++ .../android/gms/location/LocationClient.java | 95 ++++ .../gms/location/LocationListener.java | 34 ++ .../gms/location/LocationServices.java | 59 +++ .../gms/location/LocationStatusCodes.java | 26 ++ .../android/gms/location/SettingsApi.java | 42 ++ .../ActivityRecognitionApiClientBuilder.java | 35 ++ .../location/ActivityRecognitionApiImpl.java | 67 +++ .../ActivityRecognitionClientImpl.java | 38 ++ .../FusedLocationProviderApiImpl.java | 139 ++++++ .../gms/location/GeofencingApiImpl.java | 116 +++++ .../location/GoogleLocationManagerClient.java | 52 +++ .../gms/location/LocationClientImpl.java | 181 ++++++++ .../LocationServicesApiClientBuilder.java | 35 ++ .../location/NativeLocationClientImpl.java | 264 +++++++++++ .../microg/gms/location/SettingsApiImpl.java | 33 ++ settings.gradle | 4 + 192 files changed, 8562 insertions(+), 138 deletions(-) create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/CorpusStatus.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/PIMEUpdate.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/PIMEUpdateResponse.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/RequestIndexingSpecification.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/SuggestSpecification.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/SuggestionResults.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/UsageInfo.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/internal/IAppDataSearch.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/internal/ILightweightAppDataSearch.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/internal/ILightweightAppDataSearchCallbacks.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/administration/internal/ISearchAdministrationService.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/corpora/ClearCorpusRequest.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/corpora/GetCorpusInfoRequest.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/corpora/GetCorpusStatusRequest.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/corpora/GetCorpusStatusResponse.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/corpora/RequestIndexingRequest.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/corpora/RequestIndexingResponse.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/corpora/internal/ISearchCorporaCallbacks.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/corpora/internal/ISearchCorporaService.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/global/GetCurrentExperimentIdsRequest.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/global/GetCurrentExperimentIdsResponse.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/global/GetGlobalSearchSourcesRequest.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/global/GetGlobalSearchSourcesResponse.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/global/GetPendingExperimentIdsRequest.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/global/GetPendingExperimentIdsResponse.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/global/SetExperimentIdsRequest.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/global/SetExperimentIdsResponse.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/global/SetIncludeInGlobalSearchRequest.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/global/SetIncludeInGlobalSearchResponse.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/global/internal/IGlobalSearchAdminCallbacks.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/global/internal/IGlobalSearchAdminService.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/queries/QueryRequest.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/queries/QueryResponse.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/queries/internal/ISearchQueriesCallbacks.aidl create mode 100644 play-services-api/src/main/aidl/com/google/android/gms/search/queries/internal/ISearchQueriesService.aidl create mode 100644 play-services-api/src/main/java/com/google/android/gms/appdatasearch/CorpusStatus.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/appdatasearch/PIMEUpdate.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/appdatasearch/PIMEUpdateResponse.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/appdatasearch/QuerySpecification.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/appdatasearch/RequestIndexingSpecification.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/appdatasearch/SearchResults.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/appdatasearch/SuggestSpecification.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/appdatasearch/SuggestionResults.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/appdatasearch/UsageInfo.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/search/corpora/ClearCorpusRequest.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/search/corpora/GetCorpusInfoRequest.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/search/corpora/GetCorpusStatusRequest.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/search/corpora/GetCorpusStatusResponse.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/search/corpora/RequestIndexingRequest.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/search/corpora/RequestIndexingResponse.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/search/global/GetCurrentExperimentIdsRequest.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/search/global/GetCurrentExperimentIdsResponse.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/search/global/GetGlobalSearchSourcesRequest.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/search/global/GetGlobalSearchSourcesResponse.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/search/global/GetPendingExperimentIdsRequest.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/search/global/GetPendingExperimentIdsResponse.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/search/global/SetExperimentIdsRequest.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/search/global/SetExperimentIdsResponse.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/search/global/SetIncludeInGlobalSearchRequest.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/search/global/SetIncludeInGlobalSearchResponse.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/search/queries/QueryRequest.java create mode 100644 play-services-api/src/main/java/com/google/android/gms/search/queries/QueryResponse.java create mode 100644 play-services-core/src/main/java/com/google/android/gms/security/ProviderInstaller.java create mode 100644 play-services-core/src/main/java/com/mgoogle/android/gms/chimera/container/DynamiteLoaderImpl.java create mode 100644 play-services-core/src/main/java/org/microg/gms/icing/AppDataSearchImpl.java create mode 100644 play-services-core/src/main/java/org/microg/gms/icing/GlobalSearchAdminImpl.java create mode 100644 play-services-core/src/main/java/org/microg/gms/icing/IndexService.java create mode 100644 play-services-core/src/main/java/org/microg/gms/icing/LightweightAppDataSearchImpl.java create mode 100644 play-services-core/src/main/java/org/microg/gms/icing/LightweightIndexService.java create mode 100644 play-services-core/src/main/java/org/microg/gms/icing/SearchCorporaImpl.java create mode 100644 play-services-core/src/main/java/org/microg/gms/icing/SearchQueriesImpl.java create mode 100644 play-services-core/src/main/java/org/microg/gms/location/GoogleLocationManager.java create mode 100644 play-services-core/src/main/java/org/microg/gms/location/GoogleLocationManagerService.java create mode 100644 play-services-core/src/main/java/org/microg/gms/location/GoogleLocationManagerServiceImpl.java create mode 100644 play-services-core/src/main/java/org/microg/gms/location/LocationChangeListener.java create mode 100644 play-services-core/src/main/java/org/microg/gms/location/LocationRequestHelper.java create mode 100644 play-services-core/src/main/java/org/microg/gms/location/MockLocationProvider.java create mode 100644 play-services-core/src/main/java/org/microg/gms/location/RealLocationProvider.java create mode 100644 play-services-core/src/main/java/org/microg/gms/location/ReportingAndroidService.java create mode 100644 play-services-core/src/main/java/org/microg/gms/location/ReportingServiceImpl.java create mode 100644 play-services-core/src/main/java/org/microg/gms/mdm/NetworkQualityService.java create mode 100644 play-services-location-api/build.gradle create mode 100644 play-services-location-api/gradle.properties create mode 100644 play-services-location-api/src/main/AndroidManifest.xml create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/ActivityRecognitionResult.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/GeofencingRequest.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/GestureRequest.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/ILocationCallback.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/ILocationListener.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationAvailability.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationRequest.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationResult.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationSettingsRequest.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationSettingsResult.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationStatus.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/FusedLocationProviderResult.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/IFusedLocationProviderCallback.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/IGeofencerCallbacks.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/IGoogleLocationManagerService.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/ISettingsCallbacks.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/LocationRequestInternal.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/LocationRequestUpdateData.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/ParcelableGeofence.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/places/AutocompleteFilter.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/places/NearbyAlertRequest.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceFilter.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceReport.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceRequest.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/places/UserAddedPlace.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/places/UserDataType.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/places/internal/IPlacesCallbacks.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/places/internal/PlacesParams.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/ReportingState.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/UploadRequest.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/UploadRequestResult.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/internal/IReportingService.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/maps/model/LatLng.aidl create mode 100644 play-services-location-api/src/main/aidl/com/google/android/gms/maps/model/LatLngBounds.aidl create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/ActivityRecognitionResult.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/DetectedActivity.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/Geofence.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/GeofenceStatusCodes.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/GeofencingEvent.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/GeofencingRequest.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/GestureRequest.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/LocationAvailability.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/LocationRequest.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/LocationResult.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsRequest.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsResult.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsStates.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsStatusCodes.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/LocationStatus.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/internal/ClientIdentity.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/internal/FusedLocationProviderResult.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/internal/LocationRequestInternal.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/internal/LocationRequestUpdateData.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/internal/ParcelableGeofence.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/places/AutocompleteFilter.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/places/NearbyAlertRequest.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/places/Place.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceFilter.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceReport.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceRequest.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/places/UserAddedPlace.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/places/UserDataType.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/places/internal/PlaceImpl.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/places/internal/PlacesParams.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/reporting/ReportingState.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/reporting/UploadRequest.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/reporting/UploadRequestResult.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/maps/model/LatLng.java create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/maps/model/LatLngBounds.java create mode 100644 play-services-location-api/src/main/java/org/microg/gms/location/LocationConstants.java create mode 100644 play-services-location/build.gradle create mode 100644 play-services-location/gradle.properties create mode 100644 play-services-location/src/main/AndroidManifest.xml create mode 100644 play-services-location/src/main/java/com/google/android/gms/location/ActivityRecognition.java create mode 100644 play-services-location/src/main/java/com/google/android/gms/location/ActivityRecognitionApi.java create mode 100644 play-services-location/src/main/java/com/google/android/gms/location/FusedLocationProviderApi.java create mode 100644 play-services-location/src/main/java/com/google/android/gms/location/FusedLocationProviderClient.java create mode 100644 play-services-location/src/main/java/com/google/android/gms/location/GeofencingApi.java create mode 100644 play-services-location/src/main/java/com/google/android/gms/location/LocationClient.java create mode 100644 play-services-location/src/main/java/com/google/android/gms/location/LocationListener.java create mode 100644 play-services-location/src/main/java/com/google/android/gms/location/LocationServices.java create mode 100644 play-services-location/src/main/java/com/google/android/gms/location/LocationStatusCodes.java create mode 100644 play-services-location/src/main/java/com/google/android/gms/location/SettingsApi.java create mode 100644 play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionApiClientBuilder.java create mode 100644 play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionApiImpl.java create mode 100644 play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionClientImpl.java create mode 100644 play-services-location/src/main/java/org/microg/gms/location/FusedLocationProviderApiImpl.java create mode 100644 play-services-location/src/main/java/org/microg/gms/location/GeofencingApiImpl.java create mode 100644 play-services-location/src/main/java/org/microg/gms/location/GoogleLocationManagerClient.java create mode 100644 play-services-location/src/main/java/org/microg/gms/location/LocationClientImpl.java create mode 100644 play-services-location/src/main/java/org/microg/gms/location/LocationServicesApiClientBuilder.java create mode 100644 play-services-location/src/main/java/org/microg/gms/location/NativeLocationClientImpl.java create mode 100644 play-services-location/src/main/java/org/microg/gms/location/SettingsApiImpl.java diff --git a/README.md b/README.md index 98ce9923..dce456a6 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,6 @@ This fork tweaks MicroG to be usable by applications that require Google authent - Feedback - Firebase - Games - - Location - Maps - Recovery - Registering app permissions diff --git a/build.gradle b/build.gradle index 431fd969..8cb66517 100644 --- a/build.gradle +++ b/build.gradle @@ -4,6 +4,7 @@ */ buildscript { + ext.nlpVersion = '2.0-alpha4' ext.safeParcelVersion = '1.6.0' ext.kotlinVersion = '1.3.72' @@ -35,7 +36,7 @@ buildscript { } dependencies { - classpath "com.android.tools.build:gradle:4.1.0" + classpath 'com.android.tools.build:gradle:4.1.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" classpath "com.squareup.wire:wire-gradle-plugin:$wireVersion" } @@ -45,8 +46,8 @@ allprojects { apply plugin: 'idea' group = 'org.microg.gms' - version = "0.2.13.203916" - ext.appVersionCode = 203915002 + version = "0.2.14.204215" + ext.appVersionCode = 204215001 ext.isReleaseVersion = false } diff --git a/play-services-api/build.gradle b/play-services-api/build.gradle index 5e627850..778f7cea 100644 --- a/play-services-api/build.gradle +++ b/play-services-api/build.gradle @@ -37,4 +37,5 @@ dependencies { api project(':play-services-cast-api') api project(':play-services-cast-framework-api') api project(':play-services-iid-api') + api project(':play-services-location-api') } diff --git a/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/CorpusStatus.aidl b/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/CorpusStatus.aidl new file mode 100644 index 00000000..f893aef8 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/CorpusStatus.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.appdatasearch; + +parcelable CorpusStatus; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/PIMEUpdate.aidl b/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/PIMEUpdate.aidl new file mode 100644 index 00000000..c7f5e432 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/PIMEUpdate.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.appdatasearch; + +parcelable PIMEUpdate; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/PIMEUpdateResponse.aidl b/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/PIMEUpdateResponse.aidl new file mode 100644 index 00000000..0ae6e4bc --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/PIMEUpdateResponse.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.appdatasearch; + +parcelable PIMEUpdateResponse; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/RequestIndexingSpecification.aidl b/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/RequestIndexingSpecification.aidl new file mode 100644 index 00000000..a0a785c1 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/RequestIndexingSpecification.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.appdatasearch; + +parcelable RequestIndexingSpecification; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/SuggestSpecification.aidl b/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/SuggestSpecification.aidl new file mode 100644 index 00000000..0b3c47ff --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/SuggestSpecification.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.appdatasearch; + +parcelable SuggestSpecification; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/SuggestionResults.aidl b/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/SuggestionResults.aidl new file mode 100644 index 00000000..57d2d63b --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/SuggestionResults.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.appdatasearch; + +parcelable SuggestionResults; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/UsageInfo.aidl b/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/UsageInfo.aidl new file mode 100644 index 00000000..b52e3d4f --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/UsageInfo.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.appdatasearch; + +parcelable UsageInfo; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/internal/IAppDataSearch.aidl b/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/internal/IAppDataSearch.aidl new file mode 100644 index 00000000..ebc204c7 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/internal/IAppDataSearch.aidl @@ -0,0 +1,14 @@ +package com.google.android.gms.appdatasearch.internal; + +import com.google.android.gms.appdatasearch.CorpusStatus; +import com.google.android.gms.appdatasearch.PIMEUpdateResponse; +import com.google.android.gms.appdatasearch.RequestIndexingSpecification; +import com.google.android.gms.appdatasearch.SuggestionResults; +import com.google.android.gms.appdatasearch.SuggestSpecification; + +interface IAppDataSearch { + SuggestionResults getSuggestions(String var1, String packageName, in String[] accounts, int maxNum, in SuggestSpecification specs) = 1; + boolean requestIndexing(String packageName, String accountName, long l, in RequestIndexingSpecification specs) = 3; + CorpusStatus getStatus(String packageName, String accountName) = 4; + PIMEUpdateResponse requestPIMEUpdate(String s1, String s2, int i, in byte[] bs) = 34; +} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/internal/ILightweightAppDataSearch.aidl b/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/internal/ILightweightAppDataSearch.aidl new file mode 100644 index 00000000..77e618ac --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/internal/ILightweightAppDataSearch.aidl @@ -0,0 +1,8 @@ +package com.google.android.gms.appdatasearch.internal; + +import com.google.android.gms.appdatasearch.internal.ILightweightAppDataSearchCallbacks; +import com.google.android.gms.appdatasearch.UsageInfo; + +interface ILightweightAppDataSearch { + void view(ILightweightAppDataSearchCallbacks callbacks, String packageName, in UsageInfo[] usageInfos); +} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/internal/ILightweightAppDataSearchCallbacks.aidl b/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/internal/ILightweightAppDataSearchCallbacks.aidl new file mode 100644 index 00000000..338a1427 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/appdatasearch/internal/ILightweightAppDataSearchCallbacks.aidl @@ -0,0 +1,4 @@ +package com.google.android.gms.appdatasearch.internal; + +interface ILightweightAppDataSearchCallbacks { +} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/administration/internal/ISearchAdministrationService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/administration/internal/ISearchAdministrationService.aidl new file mode 100644 index 00000000..404544c2 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/administration/internal/ISearchAdministrationService.aidl @@ -0,0 +1,5 @@ +package com.google.android.gms.search.administration.internal; + +interface ISearchAdministrationService { + +} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/ClearCorpusRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/ClearCorpusRequest.aidl new file mode 100644 index 00000000..9f718934 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/ClearCorpusRequest.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.search.corpora; + +parcelable ClearCorpusRequest; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/GetCorpusInfoRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/GetCorpusInfoRequest.aidl new file mode 100644 index 00000000..11b0a4dc --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/GetCorpusInfoRequest.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.search.corpora; + +parcelable GetCorpusInfoRequest; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/GetCorpusStatusRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/GetCorpusStatusRequest.aidl new file mode 100644 index 00000000..b2e549d7 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/GetCorpusStatusRequest.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.search.corpora; + +parcelable GetCorpusStatusRequest; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/GetCorpusStatusResponse.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/GetCorpusStatusResponse.aidl new file mode 100644 index 00000000..a837a7db --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/GetCorpusStatusResponse.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.search.corpora; + +parcelable GetCorpusStatusResponse; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/RequestIndexingRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/RequestIndexingRequest.aidl new file mode 100644 index 00000000..ad68ef35 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/RequestIndexingRequest.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.search.corpora; + +parcelable RequestIndexingRequest; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/RequestIndexingResponse.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/RequestIndexingResponse.aidl new file mode 100644 index 00000000..7aaa548c --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/RequestIndexingResponse.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.search.corpora; + +parcelable RequestIndexingResponse; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/internal/ISearchCorporaCallbacks.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/internal/ISearchCorporaCallbacks.aidl new file mode 100644 index 00000000..863b016f --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/internal/ISearchCorporaCallbacks.aidl @@ -0,0 +1,9 @@ +package com.google.android.gms.search.corpora.internal; + +import com.google.android.gms.search.corpora.RequestIndexingResponse; +import com.google.android.gms.search.corpora.GetCorpusStatusResponse; + +interface ISearchCorporaCallbacks { + void onRequestIndexing(in RequestIndexingResponse response) = 1; + void onGetCorpusStatus(in GetCorpusStatusResponse response) = 3; +} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/internal/ISearchCorporaService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/internal/ISearchCorporaService.aidl new file mode 100644 index 00000000..fe2073c0 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/corpora/internal/ISearchCorporaService.aidl @@ -0,0 +1,14 @@ +package com.google.android.gms.search.corpora.internal; + +import com.google.android.gms.search.corpora.ClearCorpusRequest; +import com.google.android.gms.search.corpora.GetCorpusStatusRequest; +import com.google.android.gms.search.corpora.GetCorpusInfoRequest; +import com.google.android.gms.search.corpora.RequestIndexingRequest; +import com.google.android.gms.search.corpora.internal.ISearchCorporaCallbacks; + +interface ISearchCorporaService { + void requestIndexing(in RequestIndexingRequest request, ISearchCorporaCallbacks callbacks) = 1; + void clearCorpus(in ClearCorpusRequest request, ISearchCorporaCallbacks callbacks) = 2; + void getCorpusStatus(in GetCorpusStatusRequest request, ISearchCorporaCallbacks callbacks) = 3; + void getCorpusInfo(in GetCorpusInfoRequest request, ISearchCorporaCallbacks callbacks) = 4; +} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/global/GetCurrentExperimentIdsRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/global/GetCurrentExperimentIdsRequest.aidl new file mode 100644 index 00000000..426cbe47 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/global/GetCurrentExperimentIdsRequest.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.search.global; + +parcelable GetCurrentExperimentIdsRequest; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/global/GetCurrentExperimentIdsResponse.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/global/GetCurrentExperimentIdsResponse.aidl new file mode 100644 index 00000000..8fdb4567 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/global/GetCurrentExperimentIdsResponse.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.search.global; + +parcelable GetCurrentExperimentIdsResponse; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/global/GetGlobalSearchSourcesRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/global/GetGlobalSearchSourcesRequest.aidl new file mode 100644 index 00000000..986ab4db --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/global/GetGlobalSearchSourcesRequest.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.search.global; + +parcelable GetGlobalSearchSourcesRequest; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/global/GetGlobalSearchSourcesResponse.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/global/GetGlobalSearchSourcesResponse.aidl new file mode 100644 index 00000000..86d52a13 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/global/GetGlobalSearchSourcesResponse.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.search.global; + +parcelable GetGlobalSearchSourcesResponse; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/global/GetPendingExperimentIdsRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/global/GetPendingExperimentIdsRequest.aidl new file mode 100644 index 00000000..8d7382ed --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/global/GetPendingExperimentIdsRequest.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.search.global; + +parcelable GetPendingExperimentIdsRequest; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/global/GetPendingExperimentIdsResponse.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/global/GetPendingExperimentIdsResponse.aidl new file mode 100644 index 00000000..ca99ad5f --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/global/GetPendingExperimentIdsResponse.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.search.global; + +parcelable GetPendingExperimentIdsResponse; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/global/SetExperimentIdsRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/global/SetExperimentIdsRequest.aidl new file mode 100644 index 00000000..2bd4d8b3 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/global/SetExperimentIdsRequest.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.search.global; + +parcelable SetExperimentIdsRequest; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/global/SetExperimentIdsResponse.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/global/SetExperimentIdsResponse.aidl new file mode 100644 index 00000000..ff552760 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/global/SetExperimentIdsResponse.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.search.global; + +parcelable SetExperimentIdsResponse; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/global/SetIncludeInGlobalSearchRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/global/SetIncludeInGlobalSearchRequest.aidl new file mode 100644 index 00000000..79cbb179 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/global/SetIncludeInGlobalSearchRequest.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.search.global; + +parcelable SetIncludeInGlobalSearchRequest; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/global/SetIncludeInGlobalSearchResponse.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/global/SetIncludeInGlobalSearchResponse.aidl new file mode 100644 index 00000000..a5f2d6d0 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/global/SetIncludeInGlobalSearchResponse.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.search.global; + +parcelable SetIncludeInGlobalSearchResponse; \ No newline at end of file diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/global/internal/IGlobalSearchAdminCallbacks.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/global/internal/IGlobalSearchAdminCallbacks.aidl new file mode 100644 index 00000000..b08d9530 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/global/internal/IGlobalSearchAdminCallbacks.aidl @@ -0,0 +1,16 @@ +package com.google.android.gms.search.global.internal; + +import com.google.android.gms.search.global.GetCurrentExperimentIdsResponse; +import com.google.android.gms.search.global.GetGlobalSearchSourcesResponse; +import com.google.android.gms.search.global.GetPendingExperimentIdsResponse; +import com.google.android.gms.search.global.SetExperimentIdsResponse; +import com.google.android.gms.search.global.SetIncludeInGlobalSearchResponse; + +interface IGlobalSearchAdminCallbacks { + void onGetGlobalSearchSourcesResponse(in GetGlobalSearchSourcesResponse request) = 1; + void onSetExperimentIdsResponse(in SetExperimentIdsResponse response) = 2; + void onGetCurrentExperimentIdsResponse(in GetCurrentExperimentIdsResponse response) = 3; + void onGetPendingExperimentIdsResponse(in GetPendingExperimentIdsResponse response) = 4; + + void onSetIncludeInGlobalSearchResponse(in SetIncludeInGlobalSearchResponse response) = 7; +} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/global/internal/IGlobalSearchAdminService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/global/internal/IGlobalSearchAdminService.aidl new file mode 100644 index 00000000..95bc32a7 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/global/internal/IGlobalSearchAdminService.aidl @@ -0,0 +1,17 @@ +package com.google.android.gms.search.global.internal; + +import com.google.android.gms.search.global.GetCurrentExperimentIdsRequest; +import com.google.android.gms.search.global.GetGlobalSearchSourcesRequest; +import com.google.android.gms.search.global.GetPendingExperimentIdsRequest; +import com.google.android.gms.search.global.SetExperimentIdsRequest; +import com.google.android.gms.search.global.SetIncludeInGlobalSearchRequest; +import com.google.android.gms.search.global.internal.IGlobalSearchAdminCallbacks; + +interface IGlobalSearchAdminService { + void getGlobalSearchSources(in GetGlobalSearchSourcesRequest request, IGlobalSearchAdminCallbacks callbacks) = 1; + void setExperimentIds(in SetExperimentIdsRequest request, IGlobalSearchAdminCallbacks callbacks) = 2; + void getCurrentExperimentIds(in GetCurrentExperimentIdsRequest request, IGlobalSearchAdminCallbacks callbacks) = 3; + void getPendingExperimentIds(in GetPendingExperimentIdsRequest request, IGlobalSearchAdminCallbacks callbacks) = 4; + + void setIncludeInGlobalSearch(in SetIncludeInGlobalSearchRequest request, IGlobalSearchAdminCallbacks callbacks) = 7; +} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/queries/QueryRequest.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/queries/QueryRequest.aidl new file mode 100644 index 00000000..1986e95d --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/queries/QueryRequest.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.search.queries; + +parcelable QueryRequest; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/queries/QueryResponse.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/queries/QueryResponse.aidl new file mode 100644 index 00000000..97047253 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/queries/QueryResponse.aidl @@ -0,0 +1,3 @@ +package com.google.android.gms.search.queries; + +parcelable QueryResponse; diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/queries/internal/ISearchQueriesCallbacks.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/queries/internal/ISearchQueriesCallbacks.aidl new file mode 100644 index 00000000..8bcb891e --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/queries/internal/ISearchQueriesCallbacks.aidl @@ -0,0 +1,7 @@ +package com.google.android.gms.search.queries.internal; + +import com.google.android.gms.search.queries.QueryResponse; + +interface ISearchQueriesCallbacks { + void onQuery(in QueryResponse response) = 1; +} diff --git a/play-services-api/src/main/aidl/com/google/android/gms/search/queries/internal/ISearchQueriesService.aidl b/play-services-api/src/main/aidl/com/google/android/gms/search/queries/internal/ISearchQueriesService.aidl new file mode 100644 index 00000000..091cdae5 --- /dev/null +++ b/play-services-api/src/main/aidl/com/google/android/gms/search/queries/internal/ISearchQueriesService.aidl @@ -0,0 +1,8 @@ +package com.google.android.gms.search.queries.internal; + +import com.google.android.gms.search.queries.QueryRequest; +import com.google.android.gms.search.queries.internal.ISearchQueriesCallbacks; + +interface ISearchQueriesService { + void query(in QueryRequest request, ISearchQueriesCallbacks callbacks) = 1; +} diff --git a/play-services-api/src/main/java/com/google/android/gms/appdatasearch/CorpusStatus.java b/play-services-api/src/main/java/com/google/android/gms/appdatasearch/CorpusStatus.java new file mode 100644 index 00000000..5c71ea0c --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/appdatasearch/CorpusStatus.java @@ -0,0 +1,46 @@ +/* + * 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.appdatasearch; + +import android.os.Bundle; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +public class CorpusStatus extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode; + @SafeParceled(1) + public boolean found; + @SafeParceled(2) + public long lastIndexedSeqno; + @SafeParceled(3) + public long lastCommittedSeqno; + @SafeParceled(4) + public long committedNumDocuments; + @SafeParceled(5) + public Bundle counters; + @SafeParceled(6) + public String g; + + public CorpusStatus() { + versionCode = 2; + } + + public static final Creator CREATOR = new AutoCreator(CorpusStatus.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/appdatasearch/PIMEUpdate.java b/play-services-api/src/main/java/com/google/android/gms/appdatasearch/PIMEUpdate.java new file mode 100644 index 00000000..2f8a596f --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/appdatasearch/PIMEUpdate.java @@ -0,0 +1,24 @@ +/* + * 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.appdatasearch; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class PIMEUpdate extends AutoSafeParcelable { + + public static final Creator CREATOR = new AutoCreator(PIMEUpdate.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/appdatasearch/PIMEUpdateResponse.java b/play-services-api/src/main/java/com/google/android/gms/appdatasearch/PIMEUpdateResponse.java new file mode 100644 index 00000000..d542f48f --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/appdatasearch/PIMEUpdateResponse.java @@ -0,0 +1,42 @@ +/* + * 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.appdatasearch; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +public class PIMEUpdateResponse extends AutoSafeParcelable { + @SafeParceled(1000) + private int versionCode; + + @SafeParceled(1) + private String b; + + @SafeParceled(2) + public final byte[] bytes; + + @SafeParceled(3) + public final PIMEUpdate[] updates; + + public PIMEUpdateResponse() { + versionCode = 1; + this.bytes = null; + this.updates = new PIMEUpdate[0]; + } + + public static final Creator CREATOR = new AutoCreator(PIMEUpdateResponse.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/appdatasearch/QuerySpecification.java b/play-services-api/src/main/java/com/google/android/gms/appdatasearch/QuerySpecification.java new file mode 100644 index 00000000..1be52c8f --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/appdatasearch/QuerySpecification.java @@ -0,0 +1,72 @@ +/* + * 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.appdatasearch; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +import java.util.List; + +public class QuerySpecification extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode = 2; + @SafeParceled(1) + public final boolean b; + //@SafeParceled(value = 2, subType = "TODO") + public final List c; + //@SafeParceled(value = 3, subType = "TODO") + public final List d; + @SafeParceled(4) + public final boolean e; + @SafeParceled(5) + public final int f; + @SafeParceled(6) + public final int g; + @SafeParceled(7) + public final boolean h; + @SafeParceled(8) + public final int i; + + private QuerySpecification() { + b = false; + c = null; + d = null; + e = false; + f = 0; + g = 0; + h = false; + i = 0; + } + + @Override + public String toString() { + return "QuerySpecification{" + + "versionCode=" + versionCode + + ", b=" + b + + ", c=" + c + + ", d=" + d + + ", e=" + e + + ", f=" + f + + ", g=" + g + + ", h=" + h + + ", i=" + i + + '}'; + } + + public static final Creator CREATOR = new AutoCreator(QuerySpecification.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/appdatasearch/RequestIndexingSpecification.java b/play-services-api/src/main/java/com/google/android/gms/appdatasearch/RequestIndexingSpecification.java new file mode 100644 index 00000000..720f773c --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/appdatasearch/RequestIndexingSpecification.java @@ -0,0 +1,28 @@ +/* + * 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.appdatasearch; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +public class RequestIndexingSpecification extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode; + + public static final Creator CREATOR = new AutoCreator(RequestIndexingSpecification.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/appdatasearch/SearchResults.java b/play-services-api/src/main/java/com/google/android/gms/appdatasearch/SearchResults.java new file mode 100644 index 00000000..fec25f00 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/appdatasearch/SearchResults.java @@ -0,0 +1,27 @@ +/* + * 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.appdatasearch; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +public class SearchResults extends AutoSafeParcelable { + @SafeParceled(1000) + private int versionCode = 2; + + public static Creator CREATOR = new AutoCreator(SearchResults.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/appdatasearch/SuggestSpecification.java b/play-services-api/src/main/java/com/google/android/gms/appdatasearch/SuggestSpecification.java new file mode 100644 index 00000000..0f80a053 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/appdatasearch/SuggestSpecification.java @@ -0,0 +1,31 @@ +/* + * 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.appdatasearch; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +public class SuggestSpecification extends AutoSafeParcelable { + @SafeParceled(1000) + private int versionCode; + + public SuggestSpecification() { + versionCode = 2; + } + + public static final Creator CREATOR = new AutoCreator(SuggestSpecification.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/appdatasearch/SuggestionResults.java b/play-services-api/src/main/java/com/google/android/gms/appdatasearch/SuggestionResults.java new file mode 100644 index 00000000..f616d51d --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/appdatasearch/SuggestionResults.java @@ -0,0 +1,54 @@ +/* + * 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.appdatasearch; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +public class SuggestionResults extends AutoSafeParcelable { + @SafeParceled(1000) + private int versionCode; + @SafeParceled(1) + public final String errorMessage; + + @SafeParceled(2) + public final String[] s1; + @SafeParceled(3) + public final String[] s2; + + private SuggestionResults() { + versionCode = 2; + errorMessage = null; + s1 = s2 = null; + } + + public SuggestionResults(String errorMessage) { + versionCode = 2; + this.errorMessage = errorMessage; + this.s1 = null; + this.s2 = null; + } + + public SuggestionResults(String[] s1, String[] s2) { + versionCode = 2; + this.errorMessage = null; + this.s1 = s1; + this.s2 = s2; + } + + public static final Creator CREATOR = new AutoCreator(SuggestionResults.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/appdatasearch/UsageInfo.java b/play-services-api/src/main/java/com/google/android/gms/appdatasearch/UsageInfo.java new file mode 100644 index 00000000..a2f0f9e7 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/appdatasearch/UsageInfo.java @@ -0,0 +1,24 @@ +/* + * 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.appdatasearch; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class UsageInfo extends AutoSafeParcelable { + + public static Creator CREATOR = new AutoCreator(UsageInfo.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/search/corpora/ClearCorpusRequest.java b/play-services-api/src/main/java/com/google/android/gms/search/corpora/ClearCorpusRequest.java new file mode 100644 index 00000000..8e91b869 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/search/corpora/ClearCorpusRequest.java @@ -0,0 +1,23 @@ +/* + * 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.search.corpora; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class ClearCorpusRequest extends AutoSafeParcelable { + public static Creator CREATOR = new AutoCreator(ClearCorpusRequest.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/search/corpora/GetCorpusInfoRequest.java b/play-services-api/src/main/java/com/google/android/gms/search/corpora/GetCorpusInfoRequest.java new file mode 100644 index 00000000..2da15091 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/search/corpora/GetCorpusInfoRequest.java @@ -0,0 +1,23 @@ +/* + * 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.search.corpora; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class GetCorpusInfoRequest extends AutoSafeParcelable { + public static Creator CREATOR = new AutoCreator(GetCorpusInfoRequest.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/search/corpora/GetCorpusStatusRequest.java b/play-services-api/src/main/java/com/google/android/gms/search/corpora/GetCorpusStatusRequest.java new file mode 100644 index 00000000..051a5332 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/search/corpora/GetCorpusStatusRequest.java @@ -0,0 +1,48 @@ +/* + * 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.search.corpora; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +public class GetCorpusStatusRequest extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode = 1; + + @SafeParceled(1) + public final String packageName; + + @SafeParceled(2) + public final String corpus; + + private GetCorpusStatusRequest() { + packageName = null; + corpus = null; + } + + @Override + public String toString() { + return "GetCorpusStatusRequest{" + + "versionCode=" + versionCode + + ", packageName='" + packageName + '\'' + + ", corpus='" + corpus + '\'' + + '}'; + } + + public static Creator CREATOR = new AutoCreator(GetCorpusStatusRequest.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/search/corpora/GetCorpusStatusResponse.java b/play-services-api/src/main/java/com/google/android/gms/search/corpora/GetCorpusStatusResponse.java new file mode 100644 index 00000000..2611d67e --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/search/corpora/GetCorpusStatusResponse.java @@ -0,0 +1,47 @@ +/* + * 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.search.corpora; + +import com.google.android.gms.appdatasearch.CorpusStatus; +import com.google.android.gms.common.api.Status; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +public class GetCorpusStatusResponse extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode; + + @SafeParceled(1) + public final Status status; + + @SafeParceled(2) + public final CorpusStatus corpusStatus; + + private GetCorpusStatusResponse() { + status = null; + corpusStatus = null; + } + + public GetCorpusStatusResponse(Status status, CorpusStatus corpusStatus) { + this.status = status; + this.corpusStatus = corpusStatus; + } + + public static Creator CREATOR = new AutoCreator(GetCorpusStatusResponse.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/search/corpora/RequestIndexingRequest.java b/play-services-api/src/main/java/com/google/android/gms/search/corpora/RequestIndexingRequest.java new file mode 100644 index 00000000..4fa3396b --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/search/corpora/RequestIndexingRequest.java @@ -0,0 +1,53 @@ +/* + * 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.search.corpora; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +public class RequestIndexingRequest extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode = 1; + + @SafeParceled(1) + public final String packageName; + + @SafeParceled(2) + public final String corpus; + + @SafeParceled(3) + public final long sequenceNumber; + + private RequestIndexingRequest() { + packageName = null; + corpus = null; + sequenceNumber = 0; + } + + @Override + public String toString() { + return "RequestIndexingRequest{" + + "versionCode=" + versionCode + + ", packageName='" + packageName + '\'' + + ", corpus='" + corpus + '\'' + + ", sequenceNumber=" + sequenceNumber + + '}'; + } + + public static Creator CREATOR = new AutoCreator(RequestIndexingRequest.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/search/corpora/RequestIndexingResponse.java b/play-services-api/src/main/java/com/google/android/gms/search/corpora/RequestIndexingResponse.java new file mode 100644 index 00000000..cf25d6a7 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/search/corpora/RequestIndexingResponse.java @@ -0,0 +1,46 @@ +/* + * 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.search.corpora; + +import com.google.android.gms.common.api.Status; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +public class RequestIndexingResponse extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode; + + @SafeParceled(1) + public final Status status; + + @SafeParceled(2) + public final boolean scheduledIndexing; + + private RequestIndexingResponse() { + status = null; + scheduledIndexing = false; + } + + public RequestIndexingResponse(Status status, boolean scheduledIndexing) { + this.status = status; + this.scheduledIndexing = scheduledIndexing; + } + + public static Creator CREATOR = new AutoCreator(RequestIndexingResponse.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/search/global/GetCurrentExperimentIdsRequest.java b/play-services-api/src/main/java/com/google/android/gms/search/global/GetCurrentExperimentIdsRequest.java new file mode 100644 index 00000000..6cc364e9 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/search/global/GetCurrentExperimentIdsRequest.java @@ -0,0 +1,28 @@ +/* + * 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.search.global; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +public class GetCurrentExperimentIdsRequest extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode = 1; + + public static final Creator CREATOR = new AutoCreator(GetCurrentExperimentIdsRequest.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/search/global/GetCurrentExperimentIdsResponse.java b/play-services-api/src/main/java/com/google/android/gms/search/global/GetCurrentExperimentIdsResponse.java new file mode 100644 index 00000000..6fa3ef70 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/search/global/GetCurrentExperimentIdsResponse.java @@ -0,0 +1,57 @@ +/* + * 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.search.global; + +import com.google.android.gms.common.api.Status; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +import java.util.Arrays; + +public class GetCurrentExperimentIdsResponse extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode = 1; + + @SafeParceled(1) + public final Status status; + + @SafeParceled(2) + public final int[] experimentIds; + + private GetCurrentExperimentIdsResponse() { + status = null; + experimentIds = null; + } + + public GetCurrentExperimentIdsResponse(Status status, int[] experimentIds) { + this.status = status; + this.experimentIds = experimentIds; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("GetCurrentExperimentIdsResponse{"); + sb.append("status=").append(status); + sb.append(", experimentIds=").append(Arrays.toString(experimentIds)); + sb.append('}'); + return sb.toString(); + } + + public static final Creator CREATOR = new AutoCreator(GetCurrentExperimentIdsResponse.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/search/global/GetGlobalSearchSourcesRequest.java b/play-services-api/src/main/java/com/google/android/gms/search/global/GetGlobalSearchSourcesRequest.java new file mode 100644 index 00000000..6c062611 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/search/global/GetGlobalSearchSourcesRequest.java @@ -0,0 +1,39 @@ +/* + * 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.search.global; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +public class GetGlobalSearchSourcesRequest extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode = 1; + + @SafeParceled(1) + public boolean bool; + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("GetGlobalSearchSourcesRequest{"); + sb.append("bool=").append(bool); + sb.append('}'); + return sb.toString(); + } + + public static final Creator CREATOR = new AutoCreator(GetGlobalSearchSourcesRequest.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/search/global/GetGlobalSearchSourcesResponse.java b/play-services-api/src/main/java/com/google/android/gms/search/global/GetGlobalSearchSourcesResponse.java new file mode 100644 index 00000000..3aa8e3b2 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/search/global/GetGlobalSearchSourcesResponse.java @@ -0,0 +1,59 @@ +/* + * 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.search.global; + +import android.os.Parcelable; + +import com.google.android.gms.common.api.Status; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +import java.util.Arrays; + +public class GetGlobalSearchSourcesResponse extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode = 1; + + @SafeParceled(1) + public final Status status; + + @SafeParceled(2) + public final Parcelable[] sources; + + private GetGlobalSearchSourcesResponse() { + status = null; + sources = null; + } + + public GetGlobalSearchSourcesResponse(Status status, Parcelable[] sources) { + this.status = status; + this.sources = sources; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("GetGlobalSearchSourcesResponse{"); + sb.append("status=").append(status); + sb.append(", sources=").append(Arrays.toString(sources)); + sb.append('}'); + return sb.toString(); + } + + public static final Creator CREATOR = new AutoCreator(GetGlobalSearchSourcesResponse.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/search/global/GetPendingExperimentIdsRequest.java b/play-services-api/src/main/java/com/google/android/gms/search/global/GetPendingExperimentIdsRequest.java new file mode 100644 index 00000000..3df0a0cc --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/search/global/GetPendingExperimentIdsRequest.java @@ -0,0 +1,28 @@ +/* + * 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.search.global; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +public class GetPendingExperimentIdsRequest extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode = 1; + + public static final Creator CREATOR = new AutoCreator(GetPendingExperimentIdsRequest.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/search/global/GetPendingExperimentIdsResponse.java b/play-services-api/src/main/java/com/google/android/gms/search/global/GetPendingExperimentIdsResponse.java new file mode 100644 index 00000000..cd98184a --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/search/global/GetPendingExperimentIdsResponse.java @@ -0,0 +1,57 @@ +/* + * 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.search.global; + +import com.google.android.gms.common.api.Status; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +import java.util.Arrays; + +public class GetPendingExperimentIdsResponse extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode = 1; + + @SafeParceled(1) + public final Status status; + + @SafeParceled(2) + public final int[] experimentIds; + + private GetPendingExperimentIdsResponse() { + status = null; + experimentIds = null; + } + + public GetPendingExperimentIdsResponse(Status status, int[] experimentIds) { + this.status = status; + this.experimentIds = experimentIds; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("GetPendingExperimentIdsResponse{"); + sb.append("status=").append(status); + sb.append(", experimentIds=").append(Arrays.toString(experimentIds)); + sb.append('}'); + return sb.toString(); + } + + public static final Creator CREATOR = new AutoCreator(GetPendingExperimentIdsResponse.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/search/global/SetExperimentIdsRequest.java b/play-services-api/src/main/java/com/google/android/gms/search/global/SetExperimentIdsRequest.java new file mode 100644 index 00000000..dd6982f2 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/search/global/SetExperimentIdsRequest.java @@ -0,0 +1,45 @@ +/* + * 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.search.global; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +import java.util.Arrays; + +public class SetExperimentIdsRequest extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode = 1; + + @SafeParceled(1) + public byte[] experimentIds; + + @SafeParceled(2) + public boolean enable; + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("SetExperimentIdsRequest{"); + sb.append("experimentIds=").append(Arrays.toString(experimentIds)); + sb.append(", enable=").append(enable); + sb.append('}'); + return sb.toString(); + } + + public static final Creator CREATOR = new AutoCreator(SetExperimentIdsRequest.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/search/global/SetExperimentIdsResponse.java b/play-services-api/src/main/java/com/google/android/gms/search/global/SetExperimentIdsResponse.java new file mode 100644 index 00000000..17fb679f --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/search/global/SetExperimentIdsResponse.java @@ -0,0 +1,49 @@ +/* + * 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.search.global; + +import com.google.android.gms.common.api.Status; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +public class SetExperimentIdsResponse extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode = 1; + + @SafeParceled(1) + public final Status status; + + private SetExperimentIdsResponse() { + status = null; + } + + public SetExperimentIdsResponse(Status status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("SetExperimentIdsResponse{"); + sb.append("status=").append(status); + sb.append('}'); + return sb.toString(); + } + + public static final Creator CREATOR = new AutoCreator(SetExperimentIdsResponse.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/search/global/SetIncludeInGlobalSearchRequest.java b/play-services-api/src/main/java/com/google/android/gms/search/global/SetIncludeInGlobalSearchRequest.java new file mode 100644 index 00000000..4e4fe7b6 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/search/global/SetIncludeInGlobalSearchRequest.java @@ -0,0 +1,47 @@ +/* + * 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.search.global; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +public class SetIncludeInGlobalSearchRequest extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode = 1; + + @SafeParceled(1) + public String packageName; + + @SafeParceled(2) + public String source; + + @SafeParceled(3) + public boolean enabled; + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("SetIncludeInGlobalSearchRequest{"); + sb.append("packageName='").append(packageName).append('\''); + sb.append(", source='").append(source).append('\''); + sb.append(", enabled=").append(enabled); + sb.append('}'); + return sb.toString(); + } + + public static final Creator CREATOR = new AutoCreator(SetIncludeInGlobalSearchRequest.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/search/global/SetIncludeInGlobalSearchResponse.java b/play-services-api/src/main/java/com/google/android/gms/search/global/SetIncludeInGlobalSearchResponse.java new file mode 100644 index 00000000..c9671038 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/search/global/SetIncludeInGlobalSearchResponse.java @@ -0,0 +1,49 @@ +/* + * 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.search.global; + +import com.google.android.gms.common.api.Status; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +public class SetIncludeInGlobalSearchResponse extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode = 1; + + @SafeParceled(1) + public final Status status; + + private SetIncludeInGlobalSearchResponse() { + status = null; + } + + public SetIncludeInGlobalSearchResponse(Status status) { + this.status = status; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("SetIncludeInGlobalSearchResponse{"); + sb.append("status=").append(status); + sb.append('}'); + return sb.toString(); + } + + public static final Creator CREATOR = new AutoCreator(SetIncludeInGlobalSearchResponse.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/search/queries/QueryRequest.java b/play-services-api/src/main/java/com/google/android/gms/search/queries/QueryRequest.java new file mode 100644 index 00000000..b3f42a21 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/search/queries/QueryRequest.java @@ -0,0 +1,57 @@ +/* + * 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.search.queries; + +import com.google.android.gms.appdatasearch.QuerySpecification; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +import java.util.Arrays; + +public class QueryRequest extends AutoSafeParcelable { + + @SafeParceled(1000) + public int versionCode = 1; + @SafeParceled(1) + public String searchString; + @SafeParceled(2) + public String packageName; + @SafeParceled(3) + public String[] corpora; + @SafeParceled(4) + public int d; + @SafeParceled(5) + public int e; + @SafeParceled(6) + public QuerySpecification spec; + + @Override + public String toString() { + return "QueryRequest{" + + "versionCode=" + versionCode + + ", searchString='" + searchString + '\'' + + ", packageName='" + packageName + '\'' + + ", corpora=" + Arrays.toString(corpora) + + ", d=" + d + + ", e=" + e + + ", spec=" + spec + + '}'; + } + + public static Creator CREATOR = new AutoCreator(QueryRequest.class); +} diff --git a/play-services-api/src/main/java/com/google/android/gms/search/queries/QueryResponse.java b/play-services-api/src/main/java/com/google/android/gms/search/queries/QueryResponse.java new file mode 100644 index 00000000..a3f1ce55 --- /dev/null +++ b/play-services-api/src/main/java/com/google/android/gms/search/queries/QueryResponse.java @@ -0,0 +1,47 @@ +/* + * 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.search.queries; + +import com.google.android.gms.appdatasearch.SearchResults; +import com.google.android.gms.common.api.Status; + +import org.microg.safeparcel.AutoSafeParcelable; +import org.microg.safeparcel.SafeParceled; + +public class QueryResponse extends AutoSafeParcelable { + + @SafeParceled(1000) + private int versionCode = 1; + + @SafeParceled(1) + public final Status status; + + @SafeParceled(2) + public final SearchResults results; + + private QueryResponse() { + status = null; + results = null; + } + + public QueryResponse(Status status, SearchResults results) { + this.status = status; + this.results = results; + } + + public static Creator CREATOR = new AutoCreator(QueryResponse.class); +} diff --git a/play-services-base/build.gradle b/play-services-base/build.gradle index 67a6c3a9..47d7ead1 100644 --- a/play-services-base/build.gradle +++ b/play-services-base/build.gradle @@ -38,5 +38,5 @@ dependencies { api project(':play-services-base-api') implementation "androidx.fragment:fragment:$fragmentVersion" - implementation 'com.google.android.gms:play-services-base:17.4.0' + implementation 'com.google.android.gms:play-services-base:17.5.0' } diff --git a/play-services-base/src/main/java/org/microg/gms/common/MultiConnectionKeeper.java b/play-services-base/src/main/java/org/microg/gms/common/MultiConnectionKeeper.java index d3484f37..78c9d4f6 100644 --- a/play-services-base/src/main/java/org/microg/gms/common/MultiConnectionKeeper.java +++ b/play-services-base/src/main/java/org/microg/gms/common/MultiConnectionKeeper.java @@ -122,7 +122,20 @@ public class MultiConnectionKeeper { @SuppressLint("InlinedApi") public void bind() { Log.d(TAG, "Connection(" + actionString + ") : bind()"); - Intent intent = new Intent(actionString).setPackage(GMS_PACKAGE_NAME); + Intent gmsIntent = new Intent(actionString).setPackage(GMS_PACKAGE_NAME); + Intent selfIntent = new Intent(actionString).setPackage(context.getPackageName()); + Intent intent; + if (context.getPackageManager().resolveService(gmsIntent, 0) == null) { + Log.w(TAG, "No GMS service found for " + actionString); + if (context.getPackageManager().resolveService(selfIntent, 0) != null) { + Log.d(TAG, "Found service for "+actionString+" in self package, using it instead"); + intent = selfIntent; + } else { + return; + } + } else { + intent = gmsIntent; + } int flags = Context.BIND_AUTO_CREATE; if (SDK_INT >= ICE_CREAM_SANDWICH) { flags |= Context.BIND_ADJUST_WITH_ACTIVITY; diff --git a/play-services-basement/src/main/aidl/com/google/android/gms/common/internal/IGmsServiceBroker.aidl b/play-services-basement/src/main/aidl/com/google/android/gms/common/internal/IGmsServiceBroker.aidl index 80631e97..e65fe4ab 100644 --- a/play-services-basement/src/main/aidl/com/google/android/gms/common/internal/IGmsServiceBroker.aidl +++ b/play-services-basement/src/main/aidl/com/google/android/gms/common/internal/IGmsServiceBroker.aidl @@ -8,6 +8,8 @@ import com.google.android.gms.common.internal.ValidateAccountRequest; interface IGmsServiceBroker { void getPeopleService(IGmsCallbacks callback, int code, String str, in Bundle params) = 4; + void getReportingService(IGmsCallbacks callback, int code, String str, in Bundle params) = 5; + void getGoogleLocationManagerService(IGmsCallbacks callback, int code, String str, in Bundle params) = 7; void getPlayLogService(IGmsCallbacks callback, int code, String str, in Bundle params) = 10; void getCastMirroringService(IGmsCallbacks callback, int code, String str, in Bundle params) = 14; void getGoogleIdentityService(IGmsCallbacks callback, int code, String str, in Bundle params) = 16; diff --git a/play-services-basement/src/main/java/com/google/android/gms/common/internal/GetServiceRequest.java b/play-services-basement/src/main/java/com/google/android/gms/common/internal/GetServiceRequest.java index cb9dccd0..3bec84eb 100644 --- a/play-services-basement/src/main/java/com/google/android/gms/common/internal/GetServiceRequest.java +++ b/play-services-basement/src/main/java/com/google/android/gms/common/internal/GetServiceRequest.java @@ -29,6 +29,8 @@ import org.microg.safeparcel.SafeParceled; import java.util.Arrays; +import kotlin.Suppress; + public class GetServiceRequest extends AutoSafeParcelable { @SafeParceled(1) private int versionCode = 3; diff --git a/play-services-basement/src/main/java/org/microg/gms/common/GmsService.java b/play-services-basement/src/main/java/org/microg/gms/common/GmsService.java index 6fe5b71d..d0130ab2 100644 --- a/play-services-basement/src/main/java/org/microg/gms/common/GmsService.java +++ b/play-services-basement/src/main/java/org/microg/gms/common/GmsService.java @@ -24,13 +24,25 @@ public enum GmsService { CAST(10, "com.google.android.gms.cast.service.BIND_CAST_DEVICE_CONTROLLER_SERVICE"), ADDRESS(12, "com.google.android.gms.identity.service.BIND"), AUTH(16, "com.google.android.gms.auth.service.START"), + LIGHTWEIGHT_INDEX(19, "com.google.android.gms.icing.LIGHTWEIGHT_INDEX_SERVICE"), + INDEX(21, "com.google.android.gms.icing.INDEX_SERVICE"), + LOCATION_REPORTING(22, "com.google.android.gms.location.reporting.service.START", "com.google.android.location.reporting.service.START"), + LOCATION_MANAGER(23, "com.google.android.location.internal.GoogleLocationManagerService.START"), PLAY_LOG(24, "com.google.android.gms.playlog.service.START"), CAST_MIRRORING(27, "com.google.android.gms.cast_mirroring.service.START"), + SEARCH_ADMINISTRATION(30), + SEARCH_QUERIES(32), + SEARCH_GLOBAL(33), + SEARCH_CORPORA(36), COMMON(39, "com.google.android.gms.common.service.START"), CLEARCUT_LOGGER(40, "com.google.android.gms.clearcut.service.START"), SIGN_IN(44, "com.google.android.gms.signin.service.START"), CONTEXT_MANAGER(47, "com.google.android.contextmanager.service.ContextManagerService.START"), + LIGHTWEIGHT_NETWORK_QUALITY(50, "com.google.android.gms.herrevad.services.LightweightNetworkQualityAndroidService.START"), PHENOTYPE(51, "com.mgoogle.android.gms.phenotype.service.START"), + GEODATA(65, "com.google.android.gms.location.places.GeoDataApi"), + SEARCH_IME(66), + PLACE_DETECTION(67, "com.google.android.gms.location.places.PlaceDetectionApi"), CREDENTIALS(68, "com.google.android.gms.auth.api.credentials.service.START"), MEASUREMENT(93, "com.google.android.gms.measurement.START"), GASS(116, "com.google.android.gms.gass.START"), diff --git a/play-services-core/build.gradle b/play-services-core/build.gradle index b29aeae8..f44313d8 100644 --- a/play-services-core/build.gradle +++ b/play-services-core/build.gradle @@ -19,9 +19,10 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' dependencies { - implementation "com.squareup.wire:wire-runtime:3.4.0" + implementation 'com.squareup.wire:wire-runtime:3.5.0' implementation 'de.hdodenhof:circleimageview:3.1.0' - implementation 'org.conscrypt:conscrypt-android:2.5.1' + implementation "org.microg.gms:conscrypt-gmscore:2.5.1" + implementation "androidx.annotation:annotation:$annotationVersion" // TODO: Switch to upstream once raw requests are merged // https://github.com/vitalidze/chromecast-java-api-v2/pull/99 // implementation "su.litvak.chromecast:api-v2:0.10.4" @@ -38,16 +39,21 @@ dependencies { // AndroidX UI implementation "androidx.appcompat:appcompat:1.2.0" implementation "androidx.mediarouter:mediarouter:1.2.0" - implementation "androidx.preference:preference:$preferenceVersion" + implementation "androidx.preference:preference-ktx:$preferenceVersion" - implementation "androidx.navigation:navigation-fragment:2.3.1" - implementation "androidx.navigation:navigation-ui:2.3.1" implementation "androidx.navigation:navigation-fragment-ktx:2.3.1" implementation "androidx.navigation:navigation-ui-ktx:2.3.1" implementation "androidx.lifecycle:lifecycle-service:$lifecycleVersion" implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10' implementation project(path: ':play-services-basement') + + // nlp + 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" + api project(':play-services-location-api') } android { diff --git a/play-services-core/proguard-rules.pro b/play-services-core/proguard-rules.pro index 851afada..9a57f050 100644 --- a/play-services-core/proguard-rules.pro +++ b/play-services-core/proguard-rules.pro @@ -12,6 +12,8 @@ -dontwarn org.slf4j.** -dontwarn org.codehaus.jackson.** -dontwarn com.android.location.provider.** +-dontwarn java.lang.instrument.ClassFileTransformer +-dontwarn sun.misc.SignalHandler # Disable ProGuard Notes, they won't help here -dontnote diff --git a/play-services-core/src/main/AndroidManifest.xml b/play-services-core/src/main/AndroidManifest.xml index bc2ac327..7bcd7059 100644 --- a/play-services-core/src/main/AndroidManifest.xml +++ b/play-services-core/src/main/AndroidManifest.xml @@ -49,8 +49,10 @@ - - + + + + @@ -264,8 +266,6 @@ - - + + + + + + + + + + + + + + @@ -357,6 +371,19 @@ + + + + + + + + + + + + + @@ -393,6 +420,7 @@ + diff --git a/play-services-core/src/main/java/com/google/android/gms/common/security/ProviderInstallerImpl.java b/play-services-core/src/main/java/com/google/android/gms/common/security/ProviderInstallerImpl.java index 6d702279..de822492 100644 --- a/play-services-core/src/main/java/com/google/android/gms/common/security/ProviderInstallerImpl.java +++ b/play-services-core/src/main/java/com/google/android/gms/common/security/ProviderInstallerImpl.java @@ -1,28 +1,21 @@ /* - * 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. + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 */ package com.google.android.gms.common.security; import android.content.Context; import android.content.pm.ApplicationInfo; +import android.os.Build; import android.os.Process; import android.util.Log; -import org.conscrypt.NativeCrypto; -import org.conscrypt.OpenSSLProvider; +import androidx.annotation.Keep; + +import com.google.android.gms.org.conscrypt.Conscrypt; +import com.google.android.gms.org.conscrypt.NativeCrypto; + import org.microg.gms.common.PackageUtils; import java.io.File; @@ -33,6 +26,7 @@ import java.io.OutputStream; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.security.Provider; import java.security.Security; import java.util.Arrays; import java.util.Collections; @@ -44,132 +38,174 @@ import java.util.zip.ZipFile; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; +import static com.google.android.gms.security.ProviderInstaller.PROVIDER_NAME; + +@Keep public class ProviderInstallerImpl { private static final String TAG = "GmsProviderInstaller"; - private static final List DISABLED = Collections.unmodifiableList(Arrays.asList("com.discord", "com.bankid.bus")); + private static final List DISABLED = Collections.unmodifiableList(Arrays.asList("com.bankid.bus")); - public static void insertProvider(Context context) { + private static final Object lock = new Object(); + private static Provider provider; + + private static String getRealSelfPackageName(Context context) { String packageName = PackageUtils.packageFromProcessId(context, Process.myPid()); - Log.d(TAG, "Provider installer invoked for " + packageName); + if (packageName != null && packageName.contains(".")) return packageName; + try { + Method getBasePackageName = Context.class.getDeclaredMethod("getBasePackageName"); + packageName = (String) getBasePackageName.invoke(context); + if (packageName != null) return packageName; + } catch (Exception e) { + + } + if (Build.VERSION.SDK_INT >= 29) { + return context.getOpPackageName(); + } + Context applicationContext = context.getApplicationContext(); + if (applicationContext != null) { + return applicationContext.getPackageName(); + } + return context.getPackageName(); + } + + @Keep + public static void insertProvider(Context context) { + String packageName = getRealSelfPackageName(context); try { if (DISABLED.contains(packageName)) { - Log.d(TAG, "Package is excluded from usage of provider installer"); + Log.d(TAG, "Package " + packageName + " is excluded from usage of provider installer"); + return; + } + if (Security.getProvider(PROVIDER_NAME) != null) { + Log.d(TAG, "Provider already inserted in " + packageName); return; } - OpenSSLProvider provider = null; + synchronized (lock) { + initProvider(context, packageName); - try { - provider = new OpenSSLProvider("GmsCore_OpenSSL"); - } catch (UnsatisfiedLinkError e) { - Log.w(TAG, "Could not link conscrypt via default loader, trying manual loading"); - - // TODO: Move manual loading into helper function (as it is also used in both maps implementations) - try { - ApplicationInfo otherAppInfo = context.getPackageManager().getApplicationInfo(packageName, 0); - - String primaryCpuAbi = (String) ApplicationInfo.class.getField("primaryCpuAbi").get(otherAppInfo); - if (primaryCpuAbi != null) { - String path = "lib/" + primaryCpuAbi + "/libconscrypt_jni.so"; - File cacheFile = new File(context.createPackageContext(packageName, 0).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 conscrypt_jni from " + cacheFile.getPath()); - System.load(cacheFile.getAbsolutePath()); - - Class clazz = NativeCrypto.class; - - Field loadError = clazz.getDeclaredField("loadError"); - loadError.setAccessible(true); - loadError.set(null, null); - - Method clinit = clazz.getDeclaredMethod("clinit"); - clinit.setAccessible(true); - - Method get_cipher_names = clazz.getDeclaredMethod("get_cipher_names", String.class); - get_cipher_names.setAccessible(true); - - Method cipherSuiteToJava = clazz.getDeclaredMethod("cipherSuiteToJava", String.class); - cipherSuiteToJava.setAccessible(true); - - Method EVP_has_aes_hardware = clazz.getDeclaredMethod("EVP_has_aes_hardware"); - EVP_has_aes_hardware.setAccessible(true); - - Field f = clazz.getDeclaredField("SUPPORTED_TLS_1_2_CIPHER_SUITES_SET"); - f.setAccessible(true); - - Set SUPPORTED_TLS_1_2_CIPHER_SUITES_SET = (Set) f.get(null); - f = clazz.getDeclaredField("SUPPORTED_LEGACY_CIPHER_SUITES_SET"); - f.setAccessible(true); - - Set SUPPORTED_LEGACY_CIPHER_SUITES_SET = (Set) f.get(null); - f = clazz.getDeclaredField("SUPPORTED_TLS_1_2_CIPHER_SUITES"); - f.setAccessible(true); - - try { - clinit.invoke(null); - - String[] allCipherSuites = (String[]) get_cipher_names.invoke(null, "ALL:!DHE"); - int size = allCipherSuites.length; - - String[] SUPPORTED_TLS_1_2_CIPHER_SUITES = new String[size / 2 + 2]; - for (int i = 0; i < size; i += 2) { - String cipherSuite = (String) cipherSuiteToJava.invoke(null, allCipherSuites[i]); - - SUPPORTED_TLS_1_2_CIPHER_SUITES[i / 2] = cipherSuite; - SUPPORTED_TLS_1_2_CIPHER_SUITES_SET.add(cipherSuite); - - SUPPORTED_LEGACY_CIPHER_SUITES_SET.add(allCipherSuites[i + 1]); - } - SUPPORTED_TLS_1_2_CIPHER_SUITES[size / 2] = "TLS_EMPTY_RENEGOTIATION_INFO_SCSV"; - SUPPORTED_TLS_1_2_CIPHER_SUITES[size / 2 + 1] = "TLS_FALLBACK_SCSV"; - f.set(null, SUPPORTED_TLS_1_2_CIPHER_SUITES); - - f = clazz.getDeclaredField("HAS_AES_HARDWARE"); - f.setAccessible(true); - f.set(null, (int) EVP_has_aes_hardware.invoke(null) == 1); - - provider = new OpenSSLProvider("GmsCore_OpenSSL"); - } catch (InvocationTargetException inner) { - if (inner.getTargetException() instanceof UnsatisfiedLinkError) { - loadError.set(null, inner.getTargetException()); - } - } - } - } catch (Exception e2) { - Log.w(TAG, e2); + if (provider == null) { + Log.w(TAG, "Failed to initialize Conscrypt"); + return; } - } - if (provider == null) { - Log.w(TAG, "Failed to initialize conscrypt provider"); - return; - } + int res = Security.insertProviderAt(provider, 1); + if (res == 1) { + Security.setProperty("ssl.SocketFactory.provider", "com.google.android.gms.org.conscrypt.OpenSSLSocketFactoryImpl"); + Security.setProperty("ssl.ServerSocketFactory.provider", "com.google.android.gms.org.conscrypt.OpenSSLServerSocketFactoryImpl"); - if (Security.insertProviderAt(provider, 1) == 1) { - Security.setProperty("ssl.SocketFactory.provider", "org.conscrypt.OpenSSLSocketFactoryImpl"); - Security.setProperty("ssl.ServerSocketFactory.provider", "org.conscrypt.OpenSSLServerSocketFactoryImpl"); + SSLContext sslContext = SSLContext.getInstance("Default"); + SSLContext.setDefault(sslContext); + HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory()); - SSLContext.setDefault(SSLContext.getInstance("Default")); - HttpsURLConnection.setDefaultSSLSocketFactory(SSLContext.getDefault().getSocketFactory()); - Log.d(TAG, "SSL provider installed"); - } else { - Log.w(TAG, "Did not insert the new SSL provider"); + Log.d(TAG, "Installed default security provider " + PROVIDER_NAME); + } else { + throw new SecurityException("Failed to install security provider " + PROVIDER_NAME + ", result: " + res); + } } } catch (Throwable e) { Log.w(TAG, e); } } + private static void initProvider(Context context, String packageName) { + Log.d(TAG, "Initializing provider for " + packageName); + + try { + provider = Conscrypt.newProviderBuilder().setName(PROVIDER_NAME).defaultTlsProtocol("TLSv1.2").build(); + } catch (UnsatisfiedLinkError e) { + Log.w(TAG, "Could not link conscrypt via default loader, trying manual loading"); + + try { + loadConscryptDirect(context, packageName); + provider = Conscrypt.newProviderBuilder().setName(PROVIDER_NAME).defaultTlsProtocol("TLSv1.2").build(); + } catch (Exception e2) { + Log.w(TAG, e2); + } + } + } + + private static void loadConscryptDirect(Context context, String packageName) throws Exception { + ApplicationInfo otherAppInfo = context.getPackageManager().getApplicationInfo(packageName, 0); + + // TODO: Move manual loading into helper function (as it is also used in both maps implementations) + String primaryCpuAbi = (String) ApplicationInfo.class.getField("primaryCpuAbi").get(otherAppInfo); + if (primaryCpuAbi != null) { + String path = "lib/" + primaryCpuAbi + "/libconscrypt_jni.so"; + File cacheFile = new File(context.createPackageContext(packageName, 0).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 conscrypt_jni from " + cacheFile.getPath()); + System.load(cacheFile.getAbsolutePath()); + + Class clazz = NativeCrypto.class; + + Field loadError = clazz.getDeclaredField("loadError"); + loadError.setAccessible(true); + loadError.set(null, null); + + Method clinit = clazz.getDeclaredMethod("clinit"); + clinit.setAccessible(true); + + Method get_cipher_names = clazz.getDeclaredMethod("get_cipher_names", String.class); + get_cipher_names.setAccessible(true); + + Method cipherSuiteToJava = clazz.getDeclaredMethod("cipherSuiteToJava", String.class); + cipherSuiteToJava.setAccessible(true); + + Method EVP_has_aes_hardware = clazz.getDeclaredMethod("EVP_has_aes_hardware"); + EVP_has_aes_hardware.setAccessible(true); + + Field f = clazz.getDeclaredField("SUPPORTED_TLS_1_2_CIPHER_SUITES_SET"); + f.setAccessible(true); + + Set SUPPORTED_TLS_1_2_CIPHER_SUITES_SET = (Set) f.get(null); + f = clazz.getDeclaredField("SUPPORTED_LEGACY_CIPHER_SUITES_SET"); + f.setAccessible(true); + + Set SUPPORTED_LEGACY_CIPHER_SUITES_SET = (Set) f.get(null); + f = clazz.getDeclaredField("SUPPORTED_TLS_1_2_CIPHER_SUITES"); + f.setAccessible(true); + + try { + clinit.invoke(null); + + String[] allCipherSuites = (String[]) get_cipher_names.invoke(null, "ALL:!DHE"); + int size = allCipherSuites.length; + + String[] SUPPORTED_TLS_1_2_CIPHER_SUITES = new String[size / 2 + 2]; + for (int i = 0; i < size; i += 2) { + String cipherSuite = (String) cipherSuiteToJava.invoke(null, allCipherSuites[i]); + + SUPPORTED_TLS_1_2_CIPHER_SUITES[i / 2] = cipherSuite; + SUPPORTED_TLS_1_2_CIPHER_SUITES_SET.add(cipherSuite); + + SUPPORTED_LEGACY_CIPHER_SUITES_SET.add(allCipherSuites[i + 1]); + } + SUPPORTED_TLS_1_2_CIPHER_SUITES[size / 2] = "TLS_EMPTY_RENEGOTIATION_INFO_SCSV"; + SUPPORTED_TLS_1_2_CIPHER_SUITES[size / 2 + 1] = "TLS_FALLBACK_SCSV"; + f.set(null, SUPPORTED_TLS_1_2_CIPHER_SUITES); + + f = clazz.getDeclaredField("HAS_AES_HARDWARE"); + f.setAccessible(true); + f.set(null, (int) EVP_has_aes_hardware.invoke(null) == 1); + + } catch (InvocationTargetException inner) { + if (inner.getTargetException() instanceof UnsatisfiedLinkError) { + loadError.set(null, inner.getTargetException()); + } + } + } + } private static final void copyInputStream(InputStream in, OutputStream out) throws IOException { byte[] buffer = new byte[1024]; @@ -181,4 +217,4 @@ public class ProviderInstallerImpl { in.close(); out.close(); } -} +} \ No newline at end of file diff --git a/play-services-core/src/main/java/com/google/android/gms/security/ProviderInstaller.java b/play-services-core/src/main/java/com/google/android/gms/security/ProviderInstaller.java new file mode 100644 index 00000000..8d36dfe0 --- /dev/null +++ b/play-services-core/src/main/java/com/google/android/gms/security/ProviderInstaller.java @@ -0,0 +1,61 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + * Notice: Portions of this file are reproduced from work created and shared by Google and used + * according to terms described in the Creative Commons 4.0 Attribution License. + * See https://developers.google.com/readme/policies for details. + */ + +package com.google.android.gms.security; + +import android.content.Context; +import android.content.Intent; + +import java.security.Provider; + +/** + * A utility class for installing a dynamically updatable {@link Provider} to replace the platform default provider. + */ +public class ProviderInstaller { + public static final String PROVIDER_NAME = "GmsCore_OpenSSL"; + + /** + * Installs the dynamically updatable security provider, if it's not already installed. + * + * @throws GooglePlayServicesRepairableException + * @throws GooglePlayServicesNotAvailableException + */ + public static void installIfNeeded(Context context) { + + } + + /** + * Asynchronously installs the dynamically updatable security provider, if it's not already installed. This method must be called on the UI thread. + * + * @param context + * @param listener called when the installation completes + */ + public static void installIfNeededAsync(Context context, ProviderInstallListener listener) { + if (listener != null) listener.onProviderInstalled(); + } + + /** + * Callback for notification of the result of provider installation. + */ + public interface ProviderInstallListener { + /** + * Called when installing the provider fails. This method is always called on the UI thread. + *

+ * Implementers may use {@code errorCode} with the standard UI elements provided by {@link GoogleApiAvailability}; or {@code recoveryIntent} to implement custom UI. + * + * @param errorCode error code for the failure, for use with {@link GoogleApiAvailability#showErrorDialogFragment(Activity, int, int)} or {@link GoogleApiAvailability#showErrorNotification(Context, ConnectionResult)} + * @param recoveryIntent if non-null, an intent that can be used to install or update Google Play Services such that the provider can be installed + */ + void onProviderInstallFailed(int errorCode, Intent recoveryIntent); + + /** + * Called when installing the provider succeeds. This method is always called on the UI thread. + */ + void onProviderInstalled(); + } +} \ No newline at end of file diff --git a/play-services-core/src/main/java/com/mgoogle/android/gms/chimera/container/DynamiteLoaderImpl.java b/play-services-core/src/main/java/com/mgoogle/android/gms/chimera/container/DynamiteLoaderImpl.java new file mode 100644 index 00000000..390ddd06 --- /dev/null +++ b/play-services-core/src/main/java/com/mgoogle/android/gms/chimera/container/DynamiteLoaderImpl.java @@ -0,0 +1,74 @@ +/* + * 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.mgoogle.android.gms.chimera.container; + +import android.content.Context; +import android.content.ContextWrapper; +import android.content.pm.PackageManager; +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.dynamite.IDynamiteLoader; + +import org.microg.gms.common.Constants; + +public class DynamiteLoaderImpl extends IDynamiteLoader.Stub { + private static final String TAG = "GmsDynamiteLoaderImpl"; + + @Override + public IObjectWrapper createModuleContext(IObjectWrapper wrappedContext, String moduleId, int minVersion) throws RemoteException { + Log.d(TAG, "unimplemented Method: createModuleContext for " + moduleId + " at version " + minVersion + ", returning gms context"); + final Context context = (Context) ObjectWrapper.unwrap(wrappedContext); + try { + return ObjectWrapper.wrap(new ContextWrapper(context.createPackageContext(Constants.GMS_PACKAGE_NAME, Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY)) { + @Override + public Context getApplicationContext() { + return context; + } + }); + } catch (PackageManager.NameNotFoundException e) { + Log.w(TAG, "returning null instead", e); + return null; + } + } + + @Override + public int getModuleVersion(IObjectWrapper context, String moduleId) throws RemoteException { + return getModuleVersion2(context, moduleId, true); + } + + @Override + public int getModuleVersion2(IObjectWrapper context, String moduleId, boolean updateConfigIfRequired) throws RemoteException { + if (moduleId.equals("com.google.android.gms.googlecertificates")) { + return com.google.android.gms.dynamite.descriptors.com.google.android.gms.googlecertificates.ModuleDescriptor.MODULE_VERSION; + } + if (moduleId.equals("com.google.android.gms.cast.framework.dynamite")) { + Log.d(TAG, "returning temp fix module version for " + moduleId + ". Cast API wil not be functional!"); + return 1; + } + + if (moduleId.equals("com.google.android.gms.maps_dynamite")) { + Log.d(TAG, "returning v1 for maps"); + return 1; + } + + Log.d(TAG, "unimplemented Method: getModuleVersion for " + moduleId); + return 0; + } +} diff --git a/play-services-core/src/main/java/org/microg/gms/AbstractGmsServiceBroker.java b/play-services-core/src/main/java/org/microg/gms/AbstractGmsServiceBroker.java index db5ff38c..364295e0 100644 --- a/play-services-core/src/main/java/org/microg/gms/AbstractGmsServiceBroker.java +++ b/play-services-core/src/main/java/org/microg/gms/AbstractGmsServiceBroker.java @@ -48,6 +48,20 @@ public abstract class AbstractGmsServiceBroker extends IGmsServiceBroker.Stub { callGetService(GmsService.PEOPLE, callback, versionCode, packageName, params); } + @Deprecated + @Override + public void getReportingService(IGmsCallbacks callback, int versionCode, String packageName, + Bundle params) throws RemoteException { + callGetService(GmsService.LOCATION_REPORTING, callback, versionCode, packageName, params); + } + + @Deprecated + @Override + public void getGoogleLocationManagerService(IGmsCallbacks callback, int versionCode, + String packageName, Bundle params) throws RemoteException { + callGetService(GmsService.LOCATION_MANAGER, callback, versionCode, packageName, params); + } + @Deprecated @Override public void getPlayLogService(IGmsCallbacks callback, int versionCode, String packageName, diff --git a/play-services-core/src/main/java/org/microg/gms/icing/AppDataSearchImpl.java b/play-services-core/src/main/java/org/microg/gms/icing/AppDataSearchImpl.java new file mode 100644 index 00000000..9340def3 --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/icing/AppDataSearchImpl.java @@ -0,0 +1,64 @@ +/* + * 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.icing; + +import android.os.Parcel; +import android.os.RemoteException; +import android.util.Log; + +import com.google.android.gms.appdatasearch.CorpusStatus; +import com.google.android.gms.appdatasearch.PIMEUpdateResponse; +import com.google.android.gms.appdatasearch.RequestIndexingSpecification; +import com.google.android.gms.appdatasearch.SuggestSpecification; +import com.google.android.gms.appdatasearch.SuggestionResults; +import com.google.android.gms.appdatasearch.internal.IAppDataSearch; + +public class AppDataSearchImpl extends IAppDataSearch.Stub { + private static final String TAG = "GmsIcingAppDataImpl"; + + @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; + } + + @Override + public SuggestionResults getSuggestions(String var1, String packageName, String[] accounts, int maxNum, SuggestSpecification specs) throws RemoteException { + return new SuggestionResults("Unknown error"); + } + + @Override + public boolean requestIndexing(String packageName, String accountName, long l, RequestIndexingSpecification specs) throws RemoteException { + Log.d(TAG, "requestIndexing: " + accountName + " @ " + packageName + ", " + l); + return true; + } + + @Override + public CorpusStatus getStatus(String packageName, String accountName) throws RemoteException { + Log.d(TAG, "getStatus: " + accountName + " @ " + packageName); + CorpusStatus status = new CorpusStatus(); + status.found = true; + return status; + } + + @Override + public PIMEUpdateResponse requestPIMEUpdate(String s1, String s2, int i, byte[] bs) throws RemoteException { + Log.d(TAG, "requestPIMEUpdate: " + s1 + ", " + s2 + ", " + i + ", " + (bs == null ? "null" : new String(bs))); + return new PIMEUpdateResponse(); + } +} diff --git a/play-services-core/src/main/java/org/microg/gms/icing/GlobalSearchAdminImpl.java b/play-services-core/src/main/java/org/microg/gms/icing/GlobalSearchAdminImpl.java new file mode 100644 index 00000000..e3aaf3e2 --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/icing/GlobalSearchAdminImpl.java @@ -0,0 +1,77 @@ +/* + * 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.icing; + +import android.os.Parcel; +import android.os.Parcelable; +import android.os.RemoteException; +import android.util.Log; + +import com.google.android.gms.common.api.Status; +import com.google.android.gms.search.global.GetCurrentExperimentIdsRequest; +import com.google.android.gms.search.global.GetCurrentExperimentIdsResponse; +import com.google.android.gms.search.global.GetGlobalSearchSourcesRequest; +import com.google.android.gms.search.global.GetGlobalSearchSourcesResponse; +import com.google.android.gms.search.global.GetPendingExperimentIdsRequest; +import com.google.android.gms.search.global.GetPendingExperimentIdsResponse; +import com.google.android.gms.search.global.SetExperimentIdsRequest; +import com.google.android.gms.search.global.SetExperimentIdsResponse; +import com.google.android.gms.search.global.SetIncludeInGlobalSearchRequest; +import com.google.android.gms.search.global.SetIncludeInGlobalSearchResponse; +import com.google.android.gms.search.global.internal.IGlobalSearchAdminCallbacks; +import com.google.android.gms.search.global.internal.IGlobalSearchAdminService; + +public class GlobalSearchAdminImpl extends IGlobalSearchAdminService.Stub { + private static final String TAG = "GmsIcingGlobalImpl"; + + @Override + public void getGlobalSearchSources(GetGlobalSearchSourcesRequest request, IGlobalSearchAdminCallbacks callbacks) throws RemoteException { + Log.d(TAG, "getGlobalSearchSources: " + request); + callbacks.onGetGlobalSearchSourcesResponse(new GetGlobalSearchSourcesResponse(Status.SUCCESS, new Parcelable[0])); + } + + @Override + public void setExperimentIds(SetExperimentIdsRequest request, IGlobalSearchAdminCallbacks callbacks) throws RemoteException { + Log.d(TAG, "setExperimentIds: " + request); + callbacks.onSetExperimentIdsResponse(new SetExperimentIdsResponse(Status.SUCCESS)); + } + + @Override + public void getCurrentExperimentIds(GetCurrentExperimentIdsRequest request, IGlobalSearchAdminCallbacks callbacks) throws RemoteException { + Log.d(TAG, "getCurrentExperimentIds: " + request); + callbacks.onGetCurrentExperimentIdsResponse(new GetCurrentExperimentIdsResponse(Status.SUCCESS, new int[0])); + } + + @Override + public void getPendingExperimentIds(GetPendingExperimentIdsRequest request, IGlobalSearchAdminCallbacks callbacks) throws RemoteException { + Log.d(TAG, "getPendingExperimentIds: " + request); + callbacks.onGetPendingExperimentIdsResponse(new GetPendingExperimentIdsResponse(Status.SUCCESS, new int[0])); + } + + @Override + public void setIncludeInGlobalSearch(SetIncludeInGlobalSearchRequest request, IGlobalSearchAdminCallbacks callbacks) throws RemoteException { + Log.d(TAG, "setIncludeInGlobalSearch: " + request); + callbacks.onSetIncludeInGlobalSearchResponse(new SetIncludeInGlobalSearchResponse(Status.SUCCESS)); + } + + @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-core/src/main/java/org/microg/gms/icing/IndexService.java b/play-services-core/src/main/java/org/microg/gms/icing/IndexService.java new file mode 100644 index 00000000..6401e6ab --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/icing/IndexService.java @@ -0,0 +1,66 @@ +/* + * 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.icing; + +import android.os.RemoteException; +import android.util.Log; + +import com.google.android.gms.common.api.CommonStatusCodes; +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 IndexService extends BaseService { + private AppDataSearchImpl appDataSearch = new AppDataSearchImpl(); + private GlobalSearchAdminImpl globalSearchAdmin = new GlobalSearchAdminImpl(); + private SearchCorporaImpl searchCorpora = new SearchCorporaImpl(); + private SearchQueriesImpl searchQueries = new SearchQueriesImpl(); + + public IndexService() { + super("GmsIcingIndexSvc", + GmsService.INDEX, GmsService.SEARCH_ADMINISTRATION, GmsService.SEARCH_CORPORA, + GmsService.SEARCH_GLOBAL, GmsService.SEARCH_IME, GmsService.SEARCH_QUERIES); + } + + @Override + public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException { + switch (service) { + case INDEX: + callback.onPostInitComplete(0, appDataSearch.asBinder(), null); + break; + case SEARCH_ADMINISTRATION: + Log.w(TAG, "Service not yet implemented: " + service); + callback.onPostInitComplete(CommonStatusCodes.ERROR, null, null); + break; + case SEARCH_QUERIES: + callback.onPostInitComplete(0, searchQueries.asBinder(), null); + break; + case SEARCH_GLOBAL: + callback.onPostInitComplete(0, globalSearchAdmin.asBinder(), null); + break; + case SEARCH_CORPORA: + callback.onPostInitComplete(0, searchCorpora.asBinder(), null); + break; + case SEARCH_IME: + Log.w(TAG, "Service not yet implemented: " + service); + callback.onPostInitComplete(CommonStatusCodes.ERROR, null, null); + break; + } + } +} diff --git a/play-services-core/src/main/java/org/microg/gms/icing/LightweightAppDataSearchImpl.java b/play-services-core/src/main/java/org/microg/gms/icing/LightweightAppDataSearchImpl.java new file mode 100644 index 00000000..554d86a4 --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/icing/LightweightAppDataSearchImpl.java @@ -0,0 +1,42 @@ +/* + * 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.icing; + +import android.os.Parcel; +import android.os.RemoteException; +import android.util.Log; + +import com.google.android.gms.appdatasearch.UsageInfo; +import com.google.android.gms.appdatasearch.internal.ILightweightAppDataSearch; +import com.google.android.gms.appdatasearch.internal.ILightweightAppDataSearchCallbacks; + +import java.util.Arrays; + +public class LightweightAppDataSearchImpl extends ILightweightAppDataSearch.Stub { + private static final String TAG = "GmsIcingLightSearchImpl"; + + public void view(ILightweightAppDataSearchCallbacks callbacks, String packageName, UsageInfo[] usageInfos) { + Log.d(TAG, "view: " + Arrays.toString(usageInfos)); + } + + @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-core/src/main/java/org/microg/gms/icing/LightweightIndexService.java b/play-services-core/src/main/java/org/microg/gms/icing/LightweightIndexService.java new file mode 100644 index 00000000..2715c6ba --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/icing/LightweightIndexService.java @@ -0,0 +1,38 @@ +/* + * 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.icing; + +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 LightweightIndexService extends BaseService { + private LightweightAppDataSearchImpl appDataSearch = new LightweightAppDataSearchImpl(); + + public LightweightIndexService() { + super("GmsIcingLightIndexSvc", GmsService.LIGHTWEIGHT_INDEX); + } + + @Override + public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException { + callback.onPostInitComplete(0, appDataSearch.asBinder(), null); + } +} diff --git a/play-services-core/src/main/java/org/microg/gms/icing/SearchCorporaImpl.java b/play-services-core/src/main/java/org/microg/gms/icing/SearchCorporaImpl.java new file mode 100644 index 00000000..fa61dedb --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/icing/SearchCorporaImpl.java @@ -0,0 +1,79 @@ +/* + * 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.icing; + +import android.os.Parcel; +import android.os.RemoteException; +import android.util.Log; + +import com.google.android.gms.appdatasearch.CorpusStatus; +import com.google.android.gms.common.api.Status; +import com.google.android.gms.search.corpora.ClearCorpusRequest; +import com.google.android.gms.search.corpora.GetCorpusInfoRequest; +import com.google.android.gms.search.corpora.GetCorpusStatusRequest; +import com.google.android.gms.search.corpora.GetCorpusStatusResponse; +import com.google.android.gms.search.corpora.RequestIndexingRequest; +import com.google.android.gms.search.corpora.RequestIndexingResponse; +import com.google.android.gms.search.corpora.internal.ISearchCorporaCallbacks; +import com.google.android.gms.search.corpora.internal.ISearchCorporaService; + +import java.util.HashMap; +import java.util.Map; + +public class SearchCorporaImpl extends ISearchCorporaService.Stub { + private static final String TAG = "GmsIcingCorporaImpl"; + + // We count the sequence number here to make clients happy. + private Map corpusSequenceNumbers = new HashMap(); + + @Override + public void requestIndexing(RequestIndexingRequest request, ISearchCorporaCallbacks callbacks) throws RemoteException { + Log.d(TAG, "requestIndexing: " + request); + corpusSequenceNumbers.put(request.packageName + "/" + request.corpus, request.sequenceNumber); + callbacks.onRequestIndexing(new RequestIndexingResponse(Status.SUCCESS, true)); + } + + @Override + public void clearCorpus(ClearCorpusRequest request, ISearchCorporaCallbacks callbacks) throws RemoteException { + Log.d(TAG, "clearCorpus"); + } + + @Override + public void getCorpusStatus(GetCorpusStatusRequest request, ISearchCorporaCallbacks callbacks) throws RemoteException { + Log.d(TAG, "getCorpusStatus: " + request); + CorpusStatus status = new CorpusStatus(); + String numIndex = request.packageName + "/" + request.corpus; + if (corpusSequenceNumbers.containsKey(numIndex)) { + status.found = true; + status.lastIndexedSeqno = corpusSequenceNumbers.get(numIndex); + status.lastCommittedSeqno = status.lastIndexedSeqno; + } + callbacks.onGetCorpusStatus(new GetCorpusStatusResponse(Status.SUCCESS, status)); + } + + @Override + public void getCorpusInfo(GetCorpusInfoRequest request, ISearchCorporaCallbacks callbacks) throws RemoteException { + Log.d(TAG, "getCorpusInfo"); + } + + @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-core/src/main/java/org/microg/gms/icing/SearchQueriesImpl.java b/play-services-core/src/main/java/org/microg/gms/icing/SearchQueriesImpl.java new file mode 100644 index 00000000..2c353ab7 --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/icing/SearchQueriesImpl.java @@ -0,0 +1,44 @@ +/* + * 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.icing; + +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.search.queries.QueryRequest; +import com.google.android.gms.search.queries.QueryResponse; +import com.google.android.gms.search.queries.internal.ISearchQueriesCallbacks; +import com.google.android.gms.search.queries.internal.ISearchQueriesService; + +public class SearchQueriesImpl extends ISearchQueriesService.Stub { + private static final String TAG = "GmsIcingQueriesImpl"; + + @Override + public void query(QueryRequest request, ISearchQueriesCallbacks callbacks) throws RemoteException { + Log.d(TAG, "query: " + request); + callbacks.onQuery(new QueryResponse(Status.CANCELED, null)); + } + + @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-core/src/main/java/org/microg/gms/location/GoogleLocationManager.java b/play-services-core/src/main/java/org/microg/gms/location/GoogleLocationManager.java new file mode 100644 index 00000000..5742cb49 --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/location/GoogleLocationManager.java @@ -0,0 +1,199 @@ +/* + * 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 com.google.android.gms.location.LocationRequest.PRIORITY_HIGH_ACCURACY; + +public class GoogleLocationManager implements LocationChangeListener { + 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 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; + } + 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 = null; + 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 = null; + 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); + } + } + + 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); + } + + 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-core/src/main/java/org/microg/gms/location/GoogleLocationManagerService.java b/play-services-core/src/main/java/org/microg/gms/location/GoogleLocationManagerService.java new file mode 100644 index 00000000..e2906b1c --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/location/GoogleLocationManagerService.java @@ -0,0 +1,39 @@ +/* + * 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 android.util.Log; + +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 { + + } +} diff --git a/play-services-core/src/main/java/org/microg/gms/location/GoogleLocationManagerServiceImpl.java b/play-services-core/src/main/java/org/microg/gms/location/GoogleLocationManagerServiceImpl.java new file mode 100644 index 00000000..31ac74a3 --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/location/GoogleLocationManagerServiceImpl.java @@ -0,0 +1,357 @@ +/* + * 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-core/src/main/java/org/microg/gms/location/LocationChangeListener.java b/play-services-core/src/main/java/org/microg/gms/location/LocationChangeListener.java new file mode 100644 index 00000000..f574746d --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/location/LocationChangeListener.java @@ -0,0 +1,21 @@ +/* + * 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-core/src/main/java/org/microg/gms/location/LocationRequestHelper.java b/play-services-core/src/main/java/org/microg/gms/location/LocationRequestHelper.java new file mode 100644 index 00000000..24daa598 --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/location/LocationRequestHelper.java @@ -0,0 +1,216 @@ +/* + * 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.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 java.util.Arrays; + +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-core/src/main/java/org/microg/gms/location/MockLocationProvider.java b/play-services-core/src/main/java/org/microg/gms/location/MockLocationProvider.java new file mode 100644 index 00000000..bdeb7318 --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/location/MockLocationProvider.java @@ -0,0 +1,49 @@ +/* + * 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-core/src/main/java/org/microg/gms/location/RealLocationProvider.java b/play-services-core/src/main/java/org/microg/gms/location/RealLocationProvider.java new file mode 100644 index 00000000..98e1947a --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/location/RealLocationProvider.java @@ -0,0 +1,149 @@ +/* + * 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 static final int MIN_GPS_TIME = 10000; + + 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 void invokeOnceReady(Runnable runnable) { + // Always ready + runnable.run(); + } + + 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"); + } + if (minTime > MIN_GPS_TIME && name.equals("gps")) { + Log.d(TAG, name + ": ignoring request as " + minTime + "ms (" + sb + "), is less than " + MIN_GPS_TIME); + locationManager.removeUpdates(listener); + connected.set(false); + return; + } + 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-core/src/main/java/org/microg/gms/location/ReportingAndroidService.java b/play-services-core/src/main/java/org/microg/gms/location/ReportingAndroidService.java new file mode 100644 index 00000000..d382cdcc --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/location/ReportingAndroidService.java @@ -0,0 +1,38 @@ +/* + * 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-core/src/main/java/org/microg/gms/location/ReportingServiceImpl.java b/play-services-core/src/main/java/org/microg/gms/location/ReportingServiceImpl.java new file mode 100644 index 00000000..c091cbde --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/location/ReportingServiceImpl.java @@ -0,0 +1,61 @@ +/* + * 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-core/src/main/java/org/microg/gms/mdm/NetworkQualityService.java b/play-services-core/src/main/java/org/microg/gms/mdm/NetworkQualityService.java new file mode 100644 index 00000000..b999101b --- /dev/null +++ b/play-services-core/src/main/java/org/microg/gms/mdm/NetworkQualityService.java @@ -0,0 +1,32 @@ +/* + * 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.mdm; + +import android.app.Service; +import android.content.Intent; +import android.os.IBinder; +import android.util.Log; + +public class NetworkQualityService extends Service { + private static final String TAG = "GmsMdmQualitySvc"; + + @Override + public IBinder onBind(Intent intent) { + Log.d(TAG, "onBind: " + intent); + return null; + } +} diff --git a/play-services-core/src/main/res/values-it/strings.xml b/play-services-core/src/main/res/values-it/strings.xml index d1b4ac57..32ff1757 100755 --- a/play-services-core/src/main/res/values-it/strings.xml +++ b/play-services-core/src/main/res/values-it/strings.xml @@ -19,7 +19,7 @@ Se ciò è intenzionale, utilizza il pulsante Accedi (o Huawei, se possiedi un dispositivo con questo marchio) per connetterti alla relativa pagina di accesso Google, in caso contrario, premi Annulla per tornare all\'applicazione che ha richiamato questa finestra di dialogo." Accedi - "Il tuo dispositivo sta stabilendo una connessione ai server di Google per eseguire l\'accesso. + "Il tuo dispositivo sta stabilendo una connessione con i server di Google per eseguire l\'accesso. Questa operazione potrebbe richiedere alcuni secondi." "Non è stata rilevata alcuna connessione di rete. diff --git a/play-services-location-api/build.gradle b/play-services-location-api/build.gradle new file mode 100644 index 00000000..fb66e4c7 --- /dev/null +++ b/play-services-location-api/build.gradle @@ -0,0 +1,39 @@ +/* + * 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') + + api project(':play-services-base-api') +} diff --git a/play-services-location-api/gradle.properties b/play-services-location-api/gradle.properties new file mode 100644 index 00000000..de0a3085 --- /dev/null +++ b/play-services-location-api/gradle.properties @@ -0,0 +1,34 @@ +# +# 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 new file mode 100644 index 00000000..4a97d616 --- /dev/null +++ b/play-services-location-api/src/main/AndroidManifest.xml @@ -0,0 +1,18 @@ + + + + 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 new file mode 100644 index 00000000..52b4c775 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/ActivityRecognitionResult.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..d88a3ac8 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/GeofencingRequest.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..9fffa77a --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/GestureRequest.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..bbccd355 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/ILocationCallback.aidl @@ -0,0 +1,11 @@ +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 new file mode 100644 index 00000000..323f9059 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/ILocationListener.aidl @@ -0,0 +1,7 @@ +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 new file mode 100644 index 00000000..8037232b --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationAvailability.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..915aa2ae --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationRequest.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..d79917b7 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationResult.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..2552ed66 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationSettingsRequest.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..54dad656 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationSettingsResult.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..398d9c18 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/LocationStatus.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..37a17787 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/FusedLocationProviderResult.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..c0560fe5 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/IFusedLocationProviderCallback.aidl @@ -0,0 +1,7 @@ +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 new file mode 100644 index 00000000..ac3950f5 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/IGeofencerCallbacks.aidl @@ -0,0 +1,9 @@ +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 new file mode 100644 index 00000000..8e78a899 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/IGoogleLocationManagerService.aidl @@ -0,0 +1,88 @@ +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 new file mode 100644 index 00000000..f710d11f --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/ISettingsCallbacks.aidl @@ -0,0 +1,7 @@ +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 new file mode 100644 index 00000000..4604714a --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/LocationRequestInternal.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..812f2ca5 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/LocationRequestUpdateData.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..d4d69547 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/ParcelableGeofence.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..10b7539c --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/AutocompleteFilter.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..b34605c8 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/NearbyAlertRequest.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..07a4eec6 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceFilter.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..993899de --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceReport.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..8de920ef --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceRequest.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..aa543a60 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/UserAddedPlace.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..503493a3 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/UserDataType.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..6e912606 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/internal/IPlacesCallbacks.aidl @@ -0,0 +1,9 @@ +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 new file mode 100644 index 00000000..fa569540 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/internal/PlacesParams.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..4b1bf63c --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/ReportingState.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..69547d7e --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/UploadRequest.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..cf3ec3be --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/UploadRequestResult.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..715b6779 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/internal/IReportingService.aidl @@ -0,0 +1,15 @@ +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 new file mode 100644 index 00000000..42df9312 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/maps/model/LatLng.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..70538794 --- /dev/null +++ b/play-services-location-api/src/main/aidl/com/google/android/gms/maps/model/LatLngBounds.aidl @@ -0,0 +1,3 @@ +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 new file mode 100644 index 00000000..614c8552 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/ActivityRecognitionResult.java @@ -0,0 +1,192 @@ +/* + * 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 new file mode 100644 index 00000000..4a75a4d2 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/DetectedActivity.java @@ -0,0 +1,166 @@ +/* + * 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 new file mode 100644 index 00000000..194aed75 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/Geofence.java @@ -0,0 +1,172 @@ +/* + * 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 new file mode 100644 index 00000000..8733e4cb --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/GeofenceStatusCodes.java @@ -0,0 +1,55 @@ +/* + * 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 new file mode 100644 index 00000000..3c014f94 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/GeofencingEvent.java @@ -0,0 +1,133 @@ +/* + * 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. + */ +@SuppressWarnings("unchecked") +@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 new file mode 100644 index 00000000..2601d629 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/GeofencingRequest.java @@ -0,0 +1,27 @@ +/* + * 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 new file mode 100644 index 00000000..5222b259 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/GestureRequest.java @@ -0,0 +1,23 @@ +/* + * 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 new file mode 100644 index 00000000..c24c5bbc --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationAvailability.java @@ -0,0 +1,137 @@ +/* + * 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 new file mode 100644 index 00000000..15d159e8 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationRequest.java @@ -0,0 +1,439 @@ +/* + * 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 new file mode 100644 index 00000000..d09109fe --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationResult.java @@ -0,0 +1,45 @@ +/* + * 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 new file mode 100644 index 00000000..517ab1c8 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsRequest.java @@ -0,0 +1,109 @@ +/* + * 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 new file mode 100644 index 00000000..4269b429 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsResult.java @@ -0,0 +1,72 @@ +/* + * 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 new file mode 100644 index 00000000..194982b2 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsStates.java @@ -0,0 +1,92 @@ +/* + * 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 new file mode 100644 index 00000000..028de68c --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsStatusCodes.java @@ -0,0 +1,33 @@ +/* + * 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 new file mode 100644 index 00000000..6cd2060a --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationStatus.java @@ -0,0 +1,92 @@ +/* + * 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 new file mode 100644 index 00000000..a92c6516 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/internal/ClientIdentity.java @@ -0,0 +1,23 @@ +/* + * 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 new file mode 100644 index 00000000..b4b6516d --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/internal/FusedLocationProviderResult.java @@ -0,0 +1,40 @@ +/* + * 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 new file mode 100644 index 00000000..dd70d96a --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/internal/LocationRequestInternal.java @@ -0,0 +1,78 @@ +/* + * 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; + + @SafeParceled(9) + public boolean exemptFromThrottle; + + @SafeParceled(10) + public String moduleId; + + @Override + public String toString() { + return "LocationRequestInternal{" + + "request=" + request + + ", requestNlpDebugInfo=" + requestNlpDebugInfo + + ", restorePendingIntentListeners=" + restorePendingIntentListeners + + ", triggerUpdate=" + triggerUpdate + + ", clients=" + clients + + ", tag='" + tag + '\'' + + ", hideFromAppOps=" + hideFromAppOps + + ", forceCoarseLocation=" + forceCoarseLocation + + ", exemptFromThrottle=" + exemptFromThrottle + + ", moduleId=" + moduleId + + '}'; + } + + 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 new file mode 100644 index 00000000..6da81cc3 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/internal/LocationRequestUpdateData.java @@ -0,0 +1,67 @@ +/* + * 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 new file mode 100644 index 00000000..3abc611c --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/internal/ParcelableGeofence.java @@ -0,0 +1,77 @@ +/* + * 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 new file mode 100644 index 00000000..cf0f9238 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/places/AutocompleteFilter.java @@ -0,0 +1,31 @@ +/* + * 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 new file mode 100644 index 00000000..97c7b7e8 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/places/NearbyAlertRequest.java @@ -0,0 +1,27 @@ +/* + * 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 new file mode 100644 index 00000000..25ad8f3f --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/places/Place.java @@ -0,0 +1,384 @@ +/* + * 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 new file mode 100644 index 00000000..22bffb6b --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceFilter.java @@ -0,0 +1,27 @@ +/* + * 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 new file mode 100644 index 00000000..5919e691 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceReport.java @@ -0,0 +1,43 @@ +/* + * 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 new file mode 100644 index 00000000..ed6a8556 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceRequest.java @@ -0,0 +1,26 @@ +/* + * 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 new file mode 100644 index 00000000..eb916696 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/places/UserAddedPlace.java @@ -0,0 +1,31 @@ +/* + * 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 new file mode 100644 index 00000000..2e8776fd --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/places/UserDataType.java @@ -0,0 +1,27 @@ +/* + * 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 new file mode 100644 index 00000000..dbc23035 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/places/internal/PlaceImpl.java @@ -0,0 +1,145 @@ +/* + * 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 new file mode 100644 index 00000000..eb365fa3 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/places/internal/PlacesParams.java @@ -0,0 +1,40 @@ +/* + * 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 new file mode 100644 index 00000000..1a223471 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/reporting/ReportingState.java @@ -0,0 +1,43 @@ +/* + * 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 new file mode 100644 index 00000000..d3896f3c --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/reporting/UploadRequest.java @@ -0,0 +1,41 @@ +/* + * 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 new file mode 100644 index 00000000..2937a81c --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/reporting/UploadRequestResult.java @@ -0,0 +1,34 @@ +/* + * 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 new file mode 100644 index 00000000..545d8b46 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/maps/model/LatLng.java @@ -0,0 +1,104 @@ +/* + * 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 new file mode 100644 index 00000000..21177235 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/maps/model/LatLngBounds.java @@ -0,0 +1,227 @@ +/* + * 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: + *

    + *
  • the latitude is in the range [northeast.latitude, southwest.latitude];
  • + *
  • the longitude is in the range [southwest.longtitude, northeast.longitude] + * if southwest.longtitude ≤ northeast.longitude; and
  • + *
  • the longitude is in the range [southwest.longitude, 180) ∪ [-180, northeast.longitude] + * if southwest.longtitude > northeast.longitude.
  • + *
+ * + * @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 new file mode 100644 index 00000000..fc256bc6 --- /dev/null +++ b/play-services-location-api/src/main/java/org/microg/gms/location/LocationConstants.java @@ -0,0 +1,33 @@ +/* + * 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/build.gradle b/play-services-location/build.gradle new file mode 100644 index 00000000..076fd90f --- /dev/null +++ b/play-services-location/build.gradle @@ -0,0 +1,40 @@ +/* + * 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-base') + api project(':play-services-location-api') + + implementation 'androidx.annotation:annotation:1.1.0' +} diff --git a/play-services-location/gradle.properties b/play-services-location/gradle.properties new file mode 100644 index 00000000..bfc9b4b2 --- /dev/null +++ b/play-services-location/gradle.properties @@ -0,0 +1,34 @@ +# +# 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 new file mode 100644 index 00000000..79e10fc2 --- /dev/null +++ b/play-services-location/src/main/AndroidManifest.xml @@ -0,0 +1,24 @@ + + + + + + + + + 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 new file mode 100644 index 00000000..f8f11656 --- /dev/null +++ b/play-services-location/src/main/java/com/google/android/gms/location/ActivityRecognition.java @@ -0,0 +1,40 @@ +/* + * 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.ActivityRecognitionApiClientBuilder; +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 ActivityRecognitionApiClientBuilder()); + + /** + * 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 new file mode 100644 index 00000000..08bc50b9 --- /dev/null +++ b/play-services-location/src/main/java/com/google/android/gms/location/ActivityRecognitionApi.java @@ -0,0 +1,115 @@ +/* + * 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 new file mode 100644 index 00000000..077bae35 --- /dev/null +++ b/play-services-location/src/main/java/com/google/android/gms/location/FusedLocationProviderApi.java @@ -0,0 +1,54 @@ +/* + * 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; + +@Deprecated +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/FusedLocationProviderClient.java b/play-services-location/src/main/java/com/google/android/gms/location/FusedLocationProviderClient.java new file mode 100644 index 00000000..a391c720 --- /dev/null +++ b/play-services-location/src/main/java/com/google/android/gms/location/FusedLocationProviderClient.java @@ -0,0 +1,42 @@ +/* + * SPDX-FileCopyrightText: 2020, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.location; + +import android.content.Context; +import android.location.Location; + +import com.google.android.gms.common.api.Api; +import com.google.android.gms.common.api.GoogleApi; +import com.google.android.gms.tasks.Task; +import com.google.android.gms.tasks.TaskCompletionSource; + +import org.microg.gms.common.PublicApi; +import org.microg.gms.common.api.InstantGoogleApiCall; +import org.microg.gms.common.api.PendingGoogleApiCall; +import org.microg.gms.location.LocationClientImpl; + +@PublicApi +public class FusedLocationProviderClient extends GoogleApi { + @PublicApi(exclude = true) + public FusedLocationProviderClient(Context context) { + super(context, LocationServices.API); + } + + public Task flushLocations() { + return scheduleTask(new PendingGoogleApiCall() { + @Override + public void execute(LocationClientImpl client, TaskCompletionSource completionSource) { + completionSource.setResult(null); + } + }); + } + + public Task getLastLocation() { + return scheduleTask((InstantGoogleApiCall) LocationClientImpl::getLastLocation); + } + + +} 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 new file mode 100644 index 00000000..9efc66ce --- /dev/null +++ b/play-services-location/src/main/java/com/google/android/gms/location/GeofencingApi.java @@ -0,0 +1,49 @@ +/* + * 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()
+ * 
+ */ +@Deprecated +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 new file mode 100644 index 00000000..47ec9568 --- /dev/null +++ b/play-services-location/src/main/java/com/google/android/gms/location/LocationClient.java @@ -0,0 +1,95 @@ +/* + * 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 new file mode 100644 index 00000000..59c9585c --- /dev/null +++ b/play-services-location/src/main/java/com/google/android/gms/location/LocationListener.java @@ -0,0 +1,34 @@ +/* + * 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 new file mode 100644 index 00000000..f1f10a62 --- /dev/null +++ b/play-services-location/src/main/java/com/google/android/gms/location/LocationServices.java @@ -0,0 +1,59 @@ +/* + * 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.Context; + +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.LocationServicesApiClientBuilder; +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 LocationServicesApiClientBuilder()); + + /** + * Entry point to the fused location APIs. + */ + @Deprecated + public static final FusedLocationProviderApi FusedLocationApi = new FusedLocationProviderApiImpl(); + + /** + * Entry point to the geofencing APIs. + */ + @Deprecated + public static final GeofencingApi GeofencingApi = new GeofencingApiImpl(); + + /** + * Entry point to the location settings-enabler dialog APIs. + */ + @Deprecated + public static final SettingsApi SettingsApi = new SettingsApiImpl(); + + public static FusedLocationProviderClient getFusedLocationProviderClient(Context context) { + return new FusedLocationProviderClient(context); + } +} 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 new file mode 100644 index 00000000..4e3f7d54 --- /dev/null +++ b/play-services-location/src/main/java/com/google/android/gms/location/LocationStatusCodes.java @@ -0,0 +1,26 @@ +/* + * 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 new file mode 100644 index 00000000..b6529f7a --- /dev/null +++ b/play-services-location/src/main/java/com/google/android/gms/location/SettingsApi.java @@ -0,0 +1,42 @@ +/* + * 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. + */ +@Deprecated +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/ActivityRecognitionApiClientBuilder.java b/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionApiClientBuilder.java new file mode 100644 index 00000000..1d22bd14 --- /dev/null +++ b/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionApiClientBuilder.java @@ -0,0 +1,35 @@ +/* + * 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.Api.ApiOptions.NoOptions; + +import org.microg.gms.common.api.ApiClientBuilder; +import org.microg.gms.common.api.ApiClientSettings; +import org.microg.gms.common.api.ApiClient; +import org.microg.gms.common.api.ConnectionCallbacks; +import org.microg.gms.common.api.OnConnectionFailedListener; + +public class ActivityRecognitionApiClientBuilder implements ApiClientBuilder { + @Override + public ApiClient build(NoOptions options, Context context, Looper looper, ApiClientSettings clientSettings, ConnectionCallbacks callbacks, 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 new file mode 100644 index 00000000..5c09eefd --- /dev/null +++ b/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionApiImpl.java @@ -0,0 +1,67 @@ +/* + * 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 new file mode 100644 index 00000000..f48aa489 --- /dev/null +++ b/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionClientImpl.java @@ -0,0 +1,38 @@ +/* + * 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 org.microg.gms.common.api.ConnectionCallbacks; +import org.microg.gms.common.api.OnConnectionFailedListener; + +public class ActivityRecognitionClientImpl extends GoogleLocationManagerClient { + public ActivityRecognitionClientImpl(Context context, ConnectionCallbacks callbacks, 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 new file mode 100644 index 00000000..df10c6a8 --- /dev/null +++ b/play-services-location/src/main/java/org/microg/gms/location/FusedLocationProviderApiImpl.java @@ -0,0 +1,139 @@ +/* + * 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.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; + +@SuppressWarnings("deprecation") +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 new file mode 100644 index 00000000..15e52833 --- /dev/null +++ b/play-services-location/src/main/java/org/microg/gms/location/GeofencingApiImpl.java @@ -0,0 +1,116 @@ +/* + * 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 androidx.annotation.NonNull; + +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 new file mode 100644 index 00000000..deb26d47 --- /dev/null +++ b/play-services-location/src/main/java/org/microg/gms/location/GoogleLocationManagerClient.java @@ -0,0 +1,52 @@ +/* + * 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.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; +import org.microg.gms.common.api.ConnectionCallbacks; +import org.microg.gms.common.api.OnConnectionFailedListener; + +public abstract class GoogleLocationManagerClient extends GmsClient { + public GoogleLocationManagerClient(Context context, ConnectionCallbacks + callbacks, 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 new file mode 100644 index 00000000..b2464774 --- /dev/null +++ b/play-services-location/src/main/java/org/microg/gms/location/LocationClientImpl.java @@ -0,0 +1,181 @@ +/* + * 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.ConnectionCallbacks; +import org.microg.gms.common.api.GoogleApiClientImpl; +import org.microg.gms.common.api.OnConnectionFailedListener; + +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, ConnectionCallbacks callbacks, + 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/LocationServicesApiClientBuilder.java b/play-services-location/src/main/java/org/microg/gms/location/LocationServicesApiClientBuilder.java new file mode 100644 index 00000000..504bcc46 --- /dev/null +++ b/play-services-location/src/main/java/org/microg/gms/location/LocationServicesApiClientBuilder.java @@ -0,0 +1,35 @@ +/* + * 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.Api.ApiOptions.NoOptions; + +import org.microg.gms.common.api.ApiClientBuilder; +import org.microg.gms.common.api.ApiClientSettings; +import org.microg.gms.common.api.ApiClient; +import org.microg.gms.common.api.ConnectionCallbacks; +import org.microg.gms.common.api.OnConnectionFailedListener; + +public class LocationServicesApiClientBuilder implements ApiClientBuilder { + @Override + public ApiClient build(NoOptions options, Context context, Looper looper, ApiClientSettings clientSettings, ConnectionCallbacks callbacks, 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 new file mode 100644 index 00000000..17a017d9 --- /dev/null +++ b/play-services-location/src/main/java/org/microg/gms/location/NativeLocationClientImpl.java @@ -0,0 +1,264 @@ +/* + * 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 new file mode 100644 index 00000000..b8fe0ffe --- /dev/null +++ b/play-services-location/src/main/java/org/microg/gms/location/SettingsApiImpl.java @@ -0,0 +1,33 @@ +/* + * 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/settings.gradle b/settings.gradle index cf6f6fa8..fbb32a77 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,10 +6,14 @@ include ':play-services-cast-api' include ':play-services-cast-framework-api' include ':play-services-iid-api' +include ':play-services-location-api' +include ':play-services-location' + include ':play-services-base' include ':play-services-base-api' include ':play-services-tasks' include ':play-services-core-proto' +include ':play-services-conscrypt-provider-core' include ':play-services-core' include ':play-services-core:microg-ui-tools'