geofences, in PendingIntent pendingIntent, IGeofencerCallbacks callbacks, String packageName) = 0;
- void addGeofences(in GeofencingRequest geofencingRequest, in PendingIntent pendingIntent, IGeofencerCallbacks callbacks) = 56;
- void removeGeofencesByIntent(in PendingIntent pendingIntent, IGeofencerCallbacks callbacks, String packageName) = 1;
- void removeGeofencesById(in String[] geofenceRequestIds, IGeofencerCallbacks callbacks, String packageName) = 2;
- void removeAllGeofences(IGeofencerCallbacks callbacks, String packageName) = 3;
-
- void requestActivityUpdates(long detectionIntervalMillis, boolean alwaysTrue, in PendingIntent callbackIntent) = 4;
- void removeActivityUpdates(in PendingIntent callbackIntent) = 5;
- ActivityRecognitionResult getLastActivity(String packageName) = 63;
- Status iglms65(in PendingIntent pendingIntent) = 64;
- Status iglms66(in PendingIntent pendingIntent) = 65;
-
- Status requestGestureUpdates(in GestureRequest request, in PendingIntent pendingIntent) = 59;
- Status iglms61(in PendingIntent pendingIntent) = 60;
-
- Location getLastLocation() = 6;
- void requestLocationUpdatesWithListener(in LocationRequest request, ILocationListener listener) = 7;
- void requestLocationUpdatesWithPackage(in LocationRequest request, ILocationListener listener, String packageName) = 19;
- void requestLocationUpdatesWithIntent(in LocationRequest request, in PendingIntent callbackIntent) = 8;
- void requestLocationUpdatesInternalWithListener(in LocationRequestInternal request, ILocationListener listener) = 51;
- void requestLocationUpdatesInternalWithIntent(in LocationRequestInternal request, in PendingIntent callbackIntent) = 52;
- void removeLocationUpdatesWithListener(ILocationListener listener) = 9;
- void removeLocationUpdatesWithIntent(in PendingIntent callbackIntent) = 10;
- void updateLocationRequest(in LocationRequestUpdateData locationRequestUpdateData) = 58;
- //void flushLocations(IFusedLocationProviderCallback callback = 66;
-
- void setMockMode(boolean mockMode) = 11;
- void setMockLocation(in Location mockLocation) = 12;
-
- Location getLastLocationWithPackage(String packageName) = 20;
- void iglms26(in Location var1, int var2) = 25;
- LocationAvailability getLocationAvailabilityWithPackage(String packageName) = 33;
-
- IBinder iglms51() = 50;
- void requestLocationSettingsDialog(in LocationSettingsRequest settingsRequest, ISettingsCallbacks callback, String packageName) = 62;
-
- void iglms14(in LatLngBounds var1, int var2, in PlaceFilter var3, in PlacesParams var4, IPlacesCallbacks var5) = 13;
- void iglms15(String var1, in PlacesParams var2, IPlacesCallbacks var3) = 14;
- void iglms16(in LatLng var1, in PlaceFilter var2, in PlacesParams var3, IPlacesCallbacks var4) = 15;
- void iglms17(in PlaceFilter var1, in PlacesParams var2, IPlacesCallbacks var3) = 16;
- void iglms18(in PlaceRequest var1, in PlacesParams var2, in PendingIntent var3) = 17;
- void iglms19(in PlacesParams var1, in PendingIntent var2) = 18;
- void iglms25(in PlaceReport var1, in PlacesParams var2) = 24;
- void iglms42(String var1, in PlacesParams var2, IPlacesCallbacks var3) = 41;
- void iglms46(in UserAddedPlace var1, in PlacesParams var2, IPlacesCallbacks var3) = 45;
- void iglms47(in LatLngBounds var1, int var2, String var3, in PlaceFilter var4, in PlacesParams var5, IPlacesCallbacks var6) = 46;
- void iglms48(in NearbyAlertRequest var1, in PlacesParams var2, in PendingIntent var3) = 47;
- void iglms49(in PlacesParams var1, in PendingIntent var2) = 48;
- void iglms50(in UserDataType var1, in LatLngBounds var2, in List var3, in PlacesParams var4, IPlacesCallbacks var5) = 49;
- IBinder iglms54() = 53;
- void iglms55(String var1, in LatLngBounds var2, in AutocompleteFilter var3, in PlacesParams var4, IPlacesCallbacks var5) = 54;
- void iglms58(in List var1, in PlacesParams var2, IPlacesCallbacks var3) = 57;
-
- //void updateDeviceOrientationRequest(in DeviceOrientationRequestUpdateData request) = 74;
-}
diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/ISettingsCallbacks.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/ISettingsCallbacks.aidl
deleted file mode 100644
index f710d11f..00000000
--- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/ISettingsCallbacks.aidl
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.google.android.gms.location.internal;
-
-import com.google.android.gms.location.LocationSettingsResult;
-
-interface ISettingsCallbacks {
- void onLocationSettingsResult(in LocationSettingsResult result);
-}
diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/LocationRequestInternal.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/LocationRequestInternal.aidl
deleted file mode 100644
index 4604714a..00000000
--- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/LocationRequestInternal.aidl
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.google.android.gms.location.internal;
-
-parcelable LocationRequestInternal;
diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/LocationRequestUpdateData.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/LocationRequestUpdateData.aidl
deleted file mode 100644
index 812f2ca5..00000000
--- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/LocationRequestUpdateData.aidl
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.google.android.gms.location.internal;
-
-parcelable LocationRequestUpdateData;
diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/ParcelableGeofence.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/ParcelableGeofence.aidl
deleted file mode 100644
index d4d69547..00000000
--- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/internal/ParcelableGeofence.aidl
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.google.android.gms.location.internal;
-
-parcelable ParcelableGeofence;
\ No newline at end of file
diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/AutocompleteFilter.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/AutocompleteFilter.aidl
deleted file mode 100644
index 10b7539c..00000000
--- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/AutocompleteFilter.aidl
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.google.android.gms.location.places;
-
-parcelable AutocompleteFilter;
diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/NearbyAlertRequest.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/NearbyAlertRequest.aidl
deleted file mode 100644
index b34605c8..00000000
--- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/NearbyAlertRequest.aidl
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.google.android.gms.location.places;
-
-parcelable NearbyAlertRequest;
diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceFilter.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceFilter.aidl
deleted file mode 100644
index 07a4eec6..00000000
--- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceFilter.aidl
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.google.android.gms.location.places;
-
-parcelable PlaceFilter;
diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceReport.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceReport.aidl
deleted file mode 100644
index 993899de..00000000
--- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceReport.aidl
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.google.android.gms.location.places;
-
-parcelable PlaceReport;
diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceRequest.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceRequest.aidl
deleted file mode 100644
index 8de920ef..00000000
--- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/PlaceRequest.aidl
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.google.android.gms.location.places;
-
-parcelable PlaceRequest;
diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/UserAddedPlace.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/UserAddedPlace.aidl
deleted file mode 100644
index aa543a60..00000000
--- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/UserAddedPlace.aidl
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.google.android.gms.location.places;
-
-parcelable UserAddedPlace;
diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/UserDataType.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/UserDataType.aidl
deleted file mode 100644
index 503493a3..00000000
--- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/UserDataType.aidl
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.google.android.gms.location.places;
-
-parcelable UserDataType;
diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/internal/IPlacesCallbacks.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/internal/IPlacesCallbacks.aidl
deleted file mode 100644
index 6e912606..00000000
--- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/internal/IPlacesCallbacks.aidl
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.google.android.gms.location.places.internal;
-
-import com.google.android.gms.common.data.DataHolder;
-
-interface IPlacesCallbacks {
- void X(in DataHolder dataHolder);
- void Y(in DataHolder dataHolder);
- void Z(in DataHolder dataHolder);
-}
diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/internal/PlacesParams.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/internal/PlacesParams.aidl
deleted file mode 100644
index fa569540..00000000
--- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/places/internal/PlacesParams.aidl
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.google.android.gms.location.places.internal;
-
-parcelable PlacesParams;
diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/ReportingState.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/ReportingState.aidl
deleted file mode 100644
index 4b1bf63c..00000000
--- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/ReportingState.aidl
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.google.android.gms.location.reporting;
-
-parcelable ReportingState;
\ No newline at end of file
diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/UploadRequest.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/UploadRequest.aidl
deleted file mode 100644
index 69547d7e..00000000
--- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/UploadRequest.aidl
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.google.android.gms.location.reporting;
-
-parcelable UploadRequest;
\ No newline at end of file
diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/UploadRequestResult.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/UploadRequestResult.aidl
deleted file mode 100644
index cf3ec3be..00000000
--- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/UploadRequestResult.aidl
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.google.android.gms.location.reporting;
-
-parcelable UploadRequestResult;
\ No newline at end of file
diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/internal/IReportingService.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/internal/IReportingService.aidl
deleted file mode 100644
index 715b6779..00000000
--- a/play-services-location-api/src/main/aidl/com/google/android/gms/location/reporting/internal/IReportingService.aidl
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.google.android.gms.location.reporting.internal;
-
-import android.accounts.Account;
-import com.google.android.gms.location.places.PlaceReport;
-import com.google.android.gms.location.reporting.ReportingState;
-import com.google.android.gms.location.reporting.UploadRequest;
-import com.google.android.gms.location.reporting.UploadRequestResult;
-
-interface IReportingService {
- ReportingState getReportingState(in Account account) = 0;
- int tryOptIn(in Account account) = 1;
- UploadRequestResult requestUpload(in UploadRequest request) = 2;
- int cancelUploadRequest(long l) = 3;
- int reportDeviceAtPlace(in Account account, in PlaceReport report) = 4;
-}
diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/maps/model/LatLng.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/maps/model/LatLng.aidl
deleted file mode 100644
index 42df9312..00000000
--- a/play-services-location-api/src/main/aidl/com/google/android/gms/maps/model/LatLng.aidl
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.google.android.gms.maps.model;
-
-parcelable LatLng;
diff --git a/play-services-location-api/src/main/aidl/com/google/android/gms/maps/model/LatLngBounds.aidl b/play-services-location-api/src/main/aidl/com/google/android/gms/maps/model/LatLngBounds.aidl
deleted file mode 100644
index 70538794..00000000
--- a/play-services-location-api/src/main/aidl/com/google/android/gms/maps/model/LatLngBounds.aidl
+++ /dev/null
@@ -1,3 +0,0 @@
-package com.google.android.gms.maps.model;
-
-parcelable LatLngBounds;
\ No newline at end of file
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/ActivityRecognitionResult.java b/play-services-location-api/src/main/java/com/google/android/gms/location/ActivityRecognitionResult.java
deleted file mode 100644
index 614c8552..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/ActivityRecognitionResult.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import android.content.Intent;
-import android.os.Bundle;
-
-import org.microg.gms.common.PublicApi;
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParcelUtil;
-import org.microg.safeparcel.SafeParceled;
-
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Result of an activity recognition.
- *
- * It contains a list of activities that a user may have been doing at a particular time. The
- * activities are sorted by the most probable activity first. A confidence is associated with each
- * activity which indicates how likely that activity is.
- *
- * {@link #getMostProbableActivity()} will return the most probable activity of the user at the time
- * that activity recognition was run.
- */
-@PublicApi
-public class ActivityRecognitionResult extends AutoSafeParcelable {
-
- @PublicApi(exclude = true)
- public static final String EXTRA_ACTIVITY_RESULT = "com.google.android.location.internal.EXTRA_ACTIVITY_RESULT";
- @PublicApi(exclude = true)
- public static final String EXTRA_ACTIVITY_RESULT_LIST = "com.google.android.location.internal.EXTRA_ACTIVITY_RESULT_LIST";
-
- @SafeParceled(1000)
- private int versionCode = 2;
-
- @SafeParceled(value = 1, subClass = DetectedActivity.class)
- private List probableActivities;
-
- @SafeParceled(2)
- private long time;
-
- @SafeParceled(3)
- private long elapsedRealtimeMillis;
-
- @SafeParceled(5)
- private Bundle extras;
-
- /**
- * Constructs an ActivityRecognitionResult.
- *
- * @param probableActivities the activities that where detected, sorted by confidence (most probable first).
- * @param time the UTC time of this detection, in milliseconds since January 1, 1970.
- * @param elapsedRealtimeMillis milliseconds since boot
- */
- public ActivityRecognitionResult(List probableActivities, long time, long elapsedRealtimeMillis) {
- this(probableActivities, time, elapsedRealtimeMillis, null);
- }
-
- /**
- * Constructs an ActivityRecognitionResult from a single activity.
- *
- * @param activity the most probable activity of the device.
- * @param time the UTC time of this detection, in milliseconds since January 1, 1970.
- * @param elapsedRealtimeMillis milliseconds since boot
- */
- public ActivityRecognitionResult(DetectedActivity activity, long time, long elapsedRealtimeMillis) {
- this(Collections.singletonList(activity), time, elapsedRealtimeMillis);
- }
-
- private ActivityRecognitionResult(List probableActivities, long time, long elapsedRealtimeMillis, Bundle extras) {
- if (probableActivities == null || probableActivities.isEmpty())
- throw new IllegalArgumentException("Must have at least 1 detected activity");
- if (time <= 0 || elapsedRealtimeMillis <= 0)
- throw new IllegalArgumentException("Must set times");
- this.probableActivities = probableActivities;
- this.time = time;
- this.elapsedRealtimeMillis = elapsedRealtimeMillis;
- this.extras = extras;
- }
-
- /**
- * Extracts the ActivityRecognitionResult from an Intent.
- *
- * This is a utility function which extracts the ActivityRecognitionResult from the extras of
- * an Intent that was sent from the activity detection service.
- *
- * @return an ActivityRecognitionResult, or {@code null} if the intent doesn't contain an
- * ActivityRecognitionResult.
- */
- public static ActivityRecognitionResult extractResult(Intent intent) {
- if (intent.hasExtra(EXTRA_ACTIVITY_RESULT_LIST)) {
- intent.setExtrasClassLoader(ActivityRecognitionResult.class.getClassLoader());
- List list = intent.getParcelableArrayListExtra(EXTRA_ACTIVITY_RESULT_LIST);
- if (list != null && !list.isEmpty())
- return list.get(list.size() - 1);
- }
- if (intent.hasExtra(EXTRA_ACTIVITY_RESULT)) {
- Bundle extras = intent.getExtras();
- extras.setClassLoader(ActivityRecognitionResult.class.getClassLoader());
- Object res = extras.get(EXTRA_ACTIVITY_RESULT);
- if (res instanceof ActivityRecognitionResult)
- return (ActivityRecognitionResult) res;
- if (res instanceof byte[])
- return SafeParcelUtil.fromByteArray((byte[]) res, CREATOR);
- }
- return null;
- }
-
- /**
- * Returns the confidence of the given activity type.
- */
- public int getActivityConfidence(int activityType) {
- for (DetectedActivity activity : probableActivities) {
- if (activity.getType() == activityType)
- return activity.getConfidence();
- }
- return 0;
- }
-
- /**
- * Returns the elapsed real time of this detection in milliseconds since boot, including time
- * spent in sleep as obtained by SystemClock.elapsedRealtime().
- */
- public long getElapsedRealtimeMillis() {
- return elapsedRealtimeMillis;
- }
-
- /**
- * Returns the most probable activity of the user.
- */
- public DetectedActivity getMostProbableActivity() {
- return probableActivities.get(0);
- }
-
- /**
- * Returns the list of activities that where detected with the confidence value associated with
- * each activity. The activities are sorted by most probable activity first.
- *
- * The sum of the confidences of all detected activities this method returns does not have to
- * be <= 100 since some activities are not mutually exclusive (for example, you can be walking
- * while in a bus) and some activities are hierarchical (ON_FOOT is a generalization of WALKING
- * and RUNNING).
- */
- public List getProbableActivities() {
- return probableActivities;
- }
-
- /**
- * Returns the UTC time of this detection, in milliseconds since January 1, 1970.
- */
- public long getTime() {
- return time;
- }
-
- /**
- * Returns true if an Intent contains an ActivityRecognitionResult.
- *
- * This is a utility function that can be called from inside an intent receiver to make sure
- * the received intent is from activity recognition.
- *
- * @return true if the intent contains an ActivityRecognitionResult, false otherwise or the given intent is null
- */
- public static boolean hasResult(Intent intent) {
- if (intent == null) return false;
- if (intent.hasExtra(EXTRA_ACTIVITY_RESULT)) return true;
- intent.setExtrasClassLoader(ActivityRecognitionResult.class.getClassLoader());
- List list = intent.getParcelableArrayListExtra(EXTRA_ACTIVITY_RESULT_LIST);
- return list != null && !list.isEmpty();
- }
-
- @Override
- public String toString() {
- return "ActivityRecognitionResult [probableActivities=" + probableActivities + ", timeMillis" + time + ", elapsedRealtimeMillis=" + elapsedRealtimeMillis + "]";
- }
-
- public static final Creator CREATOR = new AutoCreator(ActivityRecognitionResult.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/DetectedActivity.java b/play-services-location-api/src/main/java/com/google/android/gms/location/DetectedActivity.java
deleted file mode 100644
index 4a75a4d2..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/DetectedActivity.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (C) 2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import org.microg.gms.common.PublicApi;
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-/**
- * The detected activity of the device with an an associated confidence. See ActivityRecognitionApi
- * for details on how to obtain a DetectedActivity.
- */
-@PublicApi
-public class DetectedActivity extends AutoSafeParcelable {
-
- /**
- * The device is in a vehicle, such as a car.
- */
- public static final int IN_VEHICLE = 0;
-
- /**
- * The device is on a bicycle.
- */
- public static final int ON_BICYCLE = 1;
-
- /**
- * The device is on a user who is walking or running.
- */
- public static final int ON_FOOT = 2;
-
- /**
- * The device is on a user who is running. This is a sub-activity of ON_FOOT.
- */
- public static final int RUNNING = 8;
-
- /**
- * The device is still (not moving).
- */
- public static final int STILL = 3;
-
- /**
- * The device angle relative to gravity changed significantly. This often occurs when a device
- * is picked up from a desk or a user who is sitting stands up.
- */
- public static final int TILTING = 5;
-
- /**
- * Unable to detect the current activity.
- */
- public static final int UNKNOWN = 4;
-
- /**
- * The device is on a user who is walking. This is a sub-activity of ON_FOOT.
- */
- public static final int WALKING = 7;
-
- @SafeParceled(1000)
- private int versionCode = 1;
-
- @SafeParceled(1)
- private int type;
-
- @SafeParceled(2)
- private int confidence;
-
- private DetectedActivity() {
- }
-
-
- /**
- * Constructs a DetectedActivity.
- *
- * @param activityType the activity that was detected.
- * @param confidence value from 0 to 100 indicating how likely it is that the user is performing this activity.
- */
- public DetectedActivity(int activityType, int confidence) {
- this.type = activityType;
- this.confidence = confidence;
- }
-
- @PublicApi(exclude = true)
- public DetectedActivity(int versionCode, int type, int confidence) {
- this.versionCode = versionCode;
- this.type = type;
- this.confidence = confidence;
- }
-
- /**
- * Returns a value from 0 to 100 indicating the likelihood that the user is performing this
- * activity.
- *
- * The larger the value, the more consistent the data used to perform the classification is
- * with the detected activity.
- *
- * This value will be <= 100. It means that larger values indicate that it's likely that the
- * detected activity is correct, while a value of <= 50 indicates that there may be another
- * activity that is just as or more likely.
- *
- * Multiple activities may have high confidence values. For example, the ON_FOOT may have a
- * confidence of 100 while the RUNNING activity may have a confidence of 95. The sum of the
- * confidences of all detected activities for a classification does not have to be <= 100 since
- * some activities are not mutually exclusive (for example, you can be walking while in a bus)
- * and some activities are hierarchical (ON_FOOT is a generalization of WALKING and RUNNING).
- */
- public int getConfidence() {
- return confidence;
- }
-
- /**
- * Returns the type of activity that was detected.
- */
- public int getType() {
- return type;
- }
-
- @PublicApi(exclude = true)
- public int getVersionCode() {
- return versionCode;
- }
-
- @Override
- public String toString() {
- return "DetectedActivity [type=" + typeToString(getType()) + ", confidence=" + getConfidence() + "]";
- }
-
- @PublicApi(exclude = true)
- public static String typeToString(int type) {
- switch (type) {
- case 0:
- return "IN_VEHICLE";
- case 1:
- return "ON_BICYCLE";
- case 2:
- return "ON_FOOT";
- case 3:
- return "STILL";
- case 4:
- return "UNKNOWN";
- case 5:
- return "TILTING";
- case 6:
- default:
- return Integer.toString(type);
- case 7:
- return "WALKING";
- case 8:
- return "RUNNING";
- }
- }
-
- public static final Creator CREATOR = new AutoCreator(DetectedActivity.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/Geofence.java b/play-services-location-api/src/main/java/com/google/android/gms/location/Geofence.java
deleted file mode 100644
index 194aed75..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/Geofence.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import android.os.SystemClock;
-
-import com.google.android.gms.location.internal.ParcelableGeofence;
-
-/**
- * Represents a geographical region, also known as a geofence. Geofences can be monitored by
- * geofencer service. And when the user crosses the boundary of a geofence, an alert will be
- * generated.
- */
-public interface Geofence {
- int GEOFENCE_TRANSITION_DWELL = 4;
-
- /**
- * The transition type indicating that the user enters the geofence(s).
- */
- int GEOFENCE_TRANSITION_ENTER = 1;
-
- /**
- * The transition type indicating that the user exits the geofence(s).
- */
- int GEOFENCE_TRANSITION_EXIT = 2;
-
- /**
- * Expiration value that indicates the geofence should never expire.
- */
- long NEVER_EXPIRE = -1L;
-
- /**
- * Returns the request ID of this geofence. The request ID is a string to identify this geofence
- * inside your application. When two geofences with the same requestId are monitored, the new
- * one will replace the old one regardless the geographical region these two geofences
- * represent.
- */
- String getRequestId();
-
- /**
- * A builder that builds {@link Geofence}.
- */
- class Builder {
- private int regionType = -1;
- private double latitude;
- private double longitude;
- private float radius;
- private long expirationTime = Long.MIN_VALUE;
- private int loiteringDelay = -1;
- private int notificationResponsiveness;
- private String requestId;
- private int transitionTypes;
-
- /**
- * Creates a geofence object.
- *
- * @throws IllegalArgumentException if any parameters are not set or out of range
- */
- public Geofence build() throws IllegalArgumentException {
- if (requestId == null) {
- throw new IllegalArgumentException("Request ID not set.");
- } else if (transitionTypes == 0) {
- throw new IllegalArgumentException("Transition types not set.");
- } else if ((transitionTypes & GEOFENCE_TRANSITION_DWELL) > 0 && loiteringDelay < 0) {
- throw new IllegalArgumentException("Non-negative loitering delay needs to be set when transition types include GEOFENCE_TRANSITION_DWELLING.");
- } else if (expirationTime == Long.MIN_VALUE) {
- throw new IllegalArgumentException("Expiration not set.");
- } else if (regionType == -1) {
- throw new IllegalArgumentException("Geofence region not set.");
- } else if (notificationResponsiveness < 0) {
- throw new IllegalArgumentException("Notification responsiveness should be nonnegative.");
- } else {
- return new ParcelableGeofence(requestId, expirationTime, regionType, latitude, longitude, radius, transitionTypes, notificationResponsiveness, loiteringDelay);
- }
- }
-
- /**
- * Sets the region of this geofence. The geofence represents a circular area on a flat, horizontal plane.
- *
- * @param latitude latitude in degrees, between -90 and +90 inclusive
- * @param longitude longitude in degrees, between -180 and +180 inclusive
- * @param radius radius in meters
- */
- public Builder setCircularRegion(double latitude, double longitude, float radius) {
- this.regionType = 1;
- this.latitude = latitude;
- this.longitude = longitude;
- this.radius = radius;
- return this;
- }
-
- /**
- * Sets the expiration duration of geofence. This geofence will be removed automatically
- * after this period of time.
- *
- * @param durationMillis time for this proximity alert, in milliseconds, or {@link #NEVER_EXPIRE}
- * to indicate no expiration. When positive, this geofence will be
- * removed automatically after this amount of time.
- */
- public Builder setExpirationDuration(long durationMillis) {
- if (durationMillis < 0) {
- expirationTime = -1;
- } else {
- expirationTime = SystemClock.elapsedRealtime() + durationMillis;
- }
- return this;
- }
-
- public Builder setLoiteringDelay(int loiteringDelayMs) {
- this.loiteringDelay = loiteringDelayMs;
- return this;
- }
-
- /**
- * Sets the best-effort notification responsiveness of the geofence. Defaults to 0. Setting
- * a big responsiveness value, for example 5 minutes, can save power significantly. However,
- * setting a very small responsiveness value, for example 5 seconds, doesn't necessarily
- * mean you will get notified right after the user enters or exits a geofence: internally,
- * the geofence might adjust the responsiveness value to save power when needed.
- *
- * @param notificationResponsivenessMs notificationResponsivenessMs (milliseconds) defines
- * the best-effort description of how soon should the
- * callback be called when the transition associated
- * with the Geofence is triggered. For instance, if set
- * to 300000 milliseconds the callback will be called 5
- * minutes within entering or exiting the geofence.
- */
- public Builder setNotificationResponsiveness(int notificationResponsivenessMs) {
- this.notificationResponsiveness = notificationResponsivenessMs;
- return this;
- }
-
- /**
- * Sets the request ID of the geofence. Request ID is a string to identify this geofence
- * inside your application. When two geofences with the same requestId are monitored, the
- * new one will replace the old one regardless the geographical region these two geofences
- * represent.
- *
- * @param requestId the request ID. The length of the string can be up to 100 characters.
- */
- public Builder setRequestId(String requestId) {
- this.requestId = requestId;
- return this;
- }
-
- /**
- * Sets the transition types of interest. Alerts are only generated for the given transition
- * types.
- *
- * @param transitionTypes geofence transition types of interest, as a bitwise-OR of
- * GEOFENCE_TRANSITION_ flags.
- */
- public Builder setTransitionTypes(int transitionTypes) {
- this.transitionTypes = transitionTypes;
- return this;
- }
- }
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/GeofenceStatusCodes.java b/play-services-location-api/src/main/java/com/google/android/gms/location/GeofenceStatusCodes.java
deleted file mode 100644
index 8733e4cb..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/GeofenceStatusCodes.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import com.google.android.gms.common.api.CommonStatusCodes;
-
-public class GeofenceStatusCodes extends CommonStatusCodes {
- /**
- * Geofence service is not available now. Typically this is because the user turned off
- * location access in settings > location access.
- */
- public static final int GEOFENCE_NOT_AVAILABLE = 1000;
-
- /**
- * Your app has registered more than 100 geofences. Remove unused ones before adding new
- * geofences.
- */
- public static final int GEOFENCE_TOO_MANY_GEOFENCES = 1001;
-
- /**
- * You have provided more than 5 different PendingIntents to the addGeofences(GoogleApiClient,
- * GeofencingRequest, PendingIntent) call.
- */
- public static final int GEOFENCE_TOO_MANY_PENDING_INTENTS = 1002;
-
- /**
- * Returns an untranslated debug (not user-friendly!) string based on the current status code.
- */
- public static String getStatusCodeString(int statusCode) {
- switch (statusCode) {
- case GEOFENCE_NOT_AVAILABLE:
- return "GEOFENCE_NOT_AVAILABLE";
- case GEOFENCE_TOO_MANY_GEOFENCES:
- return "GEOFENCE_TOO_MANY_GEOFENCES";
- case GEOFENCE_TOO_MANY_PENDING_INTENTS:
- return "GEOFENCE_TOO_MANY_PENDING_INTENTS";
- default:
- return CommonStatusCodes.getStatusCodeString(statusCode);
- }
- }
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/GeofencingEvent.java b/play-services-location-api/src/main/java/com/google/android/gms/location/GeofencingEvent.java
deleted file mode 100644
index 82b3a107..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/GeofencingEvent.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import android.content.Intent;
-import android.location.Location;
-
-import com.google.android.gms.location.internal.ParcelableGeofence;
-
-import org.microg.gms.common.PublicApi;
-import org.microg.safeparcel.SafeParcelUtil;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Represents an event from the GeofencingApi API. The event can be
- *
- * A geofence triggering event generated when a geofence transition happens.
- * An error happens after geofences are registered and being monitored.
- */
-@PublicApi
-public class GeofencingEvent {
- @PublicApi(exclude = true)
- public static final String EXTRA_ERROR_CODE = "gms_error_code";
- @PublicApi(exclude = true)
- public static final String EXTRA_TRIGGERING_LOCATION = "com.google.android.location.intent.extra.triggering_location";
- @PublicApi(exclude = true)
- public static final String EXTRA_TRANSITION = "com.google.android.location.intent.extra.transition";
- @PublicApi(exclude = true)
- public static final String EXTRA_GEOFENCE_LIST = "com.google.android.location.intent.extra.geofence_list";
-
- private int errorCode;
- private int geofenceTransition;
- private List triggeringGeofences;
- private Location triggeringLocation;
-
- /**
- * Creates a {@link GeofencingEvent} object from the given intent.
- *
- * @param intent the intent to extract the geofencing event data from
- * @return a {@link GeofencingEvent} object or {@code null} if the given intent is {@code null}
- */
- public static GeofencingEvent fromIntent(Intent intent) {
- if (intent == null) {
- return null;
- }
- GeofencingEvent event = new GeofencingEvent();
- event.errorCode = intent.getIntExtra(EXTRA_ERROR_CODE, -1);
- event.geofenceTransition = intent.getIntExtra(EXTRA_TRANSITION, -1);
- if (event.geofenceTransition != 1 && event.geofenceTransition != 2 && event.geofenceTransition != 4)
- event.geofenceTransition = -1;
- ArrayList parceledGeofences = (ArrayList) intent.getSerializableExtra(EXTRA_GEOFENCE_LIST);
- if (parceledGeofences != null) {
- event.triggeringGeofences = new ArrayList();
- for (byte[] parceledGeofence : parceledGeofences) {
- event.triggeringGeofences.add(SafeParcelUtil.fromByteArray(parceledGeofence, ParcelableGeofence.CREATOR));
- }
- }
- event.triggeringLocation = intent.getParcelableExtra(EXTRA_TRIGGERING_LOCATION);
- return event;
- }
-
- /**
- * Returns the error code that explains the error that triggered the intent specified in
- * {@link #fromIntent(Intent)}.
- *
- * @return the error code specified in {@link GeofenceStatusCodes} or {@code -1} if
- * {@link #hasError()} returns false.
- */
- public int getErrorCode() {
- return errorCode;
- }
-
- /**
- * Returns the transition type of the geofence transition alert.
- *
- * @return -1 if the intent specified in {@link #fromIntent(Intent)} is not generated for a
- * transition alert; Otherwise returns the GEOFENCE_TRANSITION_ flags value defined in
- * {@link Geofence}.
- */
- public int getGeofenceTransition() {
- return geofenceTransition;
- }
-
-
- /**
- * Returns a list of geofences that triggered this geofence transition alert.
- *
- * @return a list of geofences that triggered this geofence transition alert or {@code null} if
- * the intent specified in {@link #fromIntent(Intent)} is not generated for a geofence
- * transition alert
- */
- public List getTriggeringGeofences() {
- return triggeringGeofences;
- }
-
- /**
- * Gets the location that triggered the geofence transition. Triggering location is only
- * available if the calling app links against Google Play services 5.0 SDK.
- *
- * @return the location that triggered this geofence alert or {@code null} if it's not included
- * in the intent specified in {@link #fromIntent(Intent)}
- */
- public Location getTriggeringLocation() {
- return triggeringLocation;
- }
-
- /**
- * Whether an error triggered this intent.
- *
- * @return {@code true} if an error triggered the intent specified in
- * {@link #fromIntent(Intent)}, otherwise {@code false}
- */
- public boolean hasError() {
- return errorCode != -1;
- }
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/GeofencingRequest.java b/play-services-location-api/src/main/java/com/google/android/gms/location/GeofencingRequest.java
deleted file mode 100644
index 2601d629..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/GeofencingRequest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import org.microg.safeparcel.AutoSafeParcelable;
-
-/**
- * TODO: usage
- */
-public class GeofencingRequest extends AutoSafeParcelable {
-
- public static final Creator CREATOR = new AutoCreator(GeofencingRequest.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/GestureRequest.java b/play-services-location-api/src/main/java/com/google/android/gms/location/GestureRequest.java
deleted file mode 100644
index 5222b259..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/GestureRequest.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import org.microg.safeparcel.AutoSafeParcelable;
-
-public class GestureRequest extends AutoSafeParcelable {
- public static final Creator CREATOR = new AutoCreator(GestureRequest.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationAvailability.java b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationAvailability.java
deleted file mode 100644
index c24c5bbc..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationAvailability.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import android.content.Intent;
-
-import org.microg.gms.common.PublicApi;
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-import java.util.Arrays;
-
-/**
- * Status on the availability of location data.
- *
- * Delivered from LocationCallback registered via FusedLocationProviderApi#requestLocationUpdates(GoogleApiClient, LocationRequest, LocationCallback, Looper)
- * or from a PendingIntent registered via FusedLocationProviderApi#requestLocationUpdates(GoogleApiClient, LocationRequest, PendingIntent).
- * It is also available on demand via FusedLocationProviderApi#getLocationAvailability(GoogleApiClient).
- */
-@PublicApi
-public class LocationAvailability extends AutoSafeParcelable {
- private static final String EXTRA_KEY = "com.google.android.gms.location.EXTRA_LOCATION_AVAILABILITY";
-
- @PublicApi(exclude = true)
- public static final int STATUS_SUCCESSFUL = 0;
- @PublicApi(exclude = true)
- public static final int STATUS_UNKNOWN = 1;
- @PublicApi(exclude = true)
- public static final int STATUS_TIMED_OUT_ON_SCAN = 2;
- @PublicApi(exclude = true)
- public static final int STATUS_NO_INFO_IN_DATABASE = 3;
- @PublicApi(exclude = true)
- public static final int STATUS_INVALID_SCAN = 4;
- @PublicApi(exclude = true)
- public static final int STATUS_UNABLE_TO_QUERY_DATABASE = 5;
- @PublicApi(exclude = true)
- public static final int STATUS_SCANS_DISABLED_IN_SETTINGS = 6;
- @PublicApi(exclude = true)
- public static final int STATUS_LOCATION_DISABLED_IN_SETTINGS = 7;
- @PublicApi(exclude = true)
- public static final int STATUS_IN_PROGRESS = 8;
-
- @SafeParceled(1000)
- private int versionCode = 2;
-
- @SafeParceled(1)
- @PublicApi(exclude = true)
- public int cellStatus;
-
- @SafeParceled(2)
- @PublicApi(exclude = true)
- public int wifiStatus;
-
- @SafeParceled(3)
- @PublicApi(exclude = true)
- public long elapsedRealtimeNs;
-
- @SafeParceled(4)
- @PublicApi(exclude = true)
- public int locationStatus;
-
- @PublicApi(exclude = true)
- public LocationAvailability() {
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof LocationAvailability) {
- LocationAvailability other = (LocationAvailability) o;
- return other.cellStatus == cellStatus && other.wifiStatus == wifiStatus && other.elapsedRealtimeNs == elapsedRealtimeNs && other.locationStatus == locationStatus;
- }
- return false;
- }
-
- /**
- * Extracts the {@link LocationAvailability} from an Intent.
- *
- * This is a utility function which extracts the {@link LocationAvailability} from the extras
- * of an Intent that was sent in response to a location request.
- *
- * @return a {@link LocationAvailability}, or null if the Intent doesn't contain this data.
- */
- public static LocationAvailability extractLocationAvailability(Intent intent) {
- if (!hasLocationAvailability(intent)) {
- return null;
- }
- return intent.getParcelableExtra(EXTRA_KEY);
- }
-
- /**
- * Returns true if an Intent contains a {@link LocationAvailability}.
- *
- * This is a utility function that can be called from inside an intent receiver to make sure the
- * received intent contains location availability data.
- *
- * @return true if the intent contains a {@link LocationAvailability}, false otherwise.
- */
- public static boolean hasLocationAvailability(Intent intent) {
- return intent != null && intent.hasExtra(EXTRA_KEY);
- }
-
- @Override
- public int hashCode() {
- return Arrays.hashCode(new Object[]{locationStatus, cellStatus, wifiStatus, elapsedRealtimeNs});
- }
-
- /**
- * Returns true if the device location is known and reasonably up to date within the hints
- * requested by the active {@link LocationRequest}s. Failure to determine location may result
- * from a number of causes including disabled location settings or an inability to retrieve
- * sensor data in the device's environment.
- */
- public boolean isLocationAvailable() {
- return locationStatus < 1000;
- }
-
- @Override
- public String toString() {
- return "LocationAvailability[isLocationAvailable: " + isLocationAvailable() + "]";
- }
-
- public static final Creator CREATOR = new AutoCreator(LocationAvailability.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationRequest.java b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationRequest.java
deleted file mode 100644
index 15d159e8..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationRequest.java
+++ /dev/null
@@ -1,439 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import android.os.SystemClock;
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-import java.util.Arrays;
-
-/**
- * A data object that contains quality of service parameters for requests to the
- * FusedLocationProviderApi.
- *
- * LocationRequest objects are used to request a quality of service for location updates from the
- * FusedLocationProviderApi.
- *
- * For example, if your application wants high accuracy location it should create a location
- * request with {@link #setPriority(int)} set to {@link #PRIORITY_HIGH_ACCURACY} and
- * {@link #setInterval(long)} to 5 seconds. This would be appropriate for mapping applications that
- * are showing your location in real-time.
- *
- * At the other extreme, if you want negligible power impact, but to still receive location updates
- * when available, then create a location request with {@link #setPriority(int)} set to
- * {@link #PRIORITY_NO_POWER}. With this request your application will not trigger (and therefore
- * will not receive any power blame) any location updates, but will receive locations triggered by
- * other applications. This would be appropriate for applications that have no firm requirement for
- * location, but can take advantage when available.
- *
- * In between these two extremes is a very common use-case, where applications definitely want to
- * receive updates at a specified interval, and can receive them faster when available, but still
- * want a low power impact. These applications should consider
- * {@link #PRIORITY_BALANCED_POWER_ACCURACY} combined with a faster
- * {@link #setFastestInterval(long)} (such as 1 minute) and a slower {@link #setInterval(long)}
- * (such as 60 minutes). They will only be assigned power blame for the interval set by
- * {@link #setInterval(long)}, but can still receive locations triggered by other applications at a
- * rate up to {@link #setFastestInterval(long)}. This style of request is appropriate for many
- * location aware applications, including background usage. Do be careful to also throttle
- * {@link #setFastestInterval(long)} if you perform heavy-weight work after receiving an update -
- * such as using the network.
- *
- * Activities should strongly consider removing all location request when entering the background
- * (for example at {@link android.app.Activity#onPause()}), or at least swap the request to a
- * larger interval and lower quality.
- *
- * Applications cannot specify the exact location sources, such as GPS, that are used by the
- * LocationClient. In fact, the system may have multiple location sources (providers) running and
- * may fuse the results from several sources into a single Location object.
- *
- * Location requests from applications with
- * {@link android.Manifest.permission#ACCESS_COARSE_LOCATION} and not
- * {@link android.Manifest.permission#ACCESS_FINE_LOCATION} will be automatically throttled to a
- * slower interval, and the location object will be obfuscated to only show a coarse level of
- * accuracy.
- *
- * All location requests are considered hints, and you may receive locations that are more/less
- * accurate, and faster/slower than requested.
- */
-public class LocationRequest extends AutoSafeParcelable {
-
- /**
- * Used with {@link #setPriority(int)} to request "block" level accuracy.
- *
- * Block level accuracy is considered to be about 100 meter accuracy. Using a coarse accuracy
- * such as this often consumes less power.
- */
- public static final int PRIORITY_BALANCED_POWER_ACCURACY = 102;
- /**
- * Used with {@link #setPriority(int)} to request the most accurate locations available.
- *
- * This will return the finest location available.
- */
- public static final int PRIORITY_HIGH_ACCURACY = 100;
- /**
- * Used with {@link #setPriority(int)} to request "city" level accuracy.
- *
- * City level accuracy is considered to be about 10km accuracy. Using a coarse accuracy such as
- * this often consumes less power.
- */
- public static final int PRIORITY_LOW_POWER = 104;
- /**
- * Used with {@link #setPriority(int)} to request the best accuracy possible with zero
- * additional power consumption.
- *
- * No locations will be returned unless a different client has requested location updates in
- * which case this request will act as a passive listener to those locations.
- */
- public static final int PRIORITY_NO_POWER = 105;
-
- @SafeParceled(1000)
- private int versionCode = 1;
- @SafeParceled(1)
- private int priority;
- @SafeParceled(2)
- private long interval;
- @SafeParceled(3)
- private long fastestInterval;
- @SafeParceled(4)
- private boolean explicitFastestInterval;
- @SafeParceled(5)
- private long expirationTime;
- @SafeParceled(6)
- private int numUpdates;
- @SafeParceled(7)
- private float smallestDesplacement;
- @SafeParceled(8)
- private long maxWaitTime;
-
- public LocationRequest() {
- this.priority = PRIORITY_BALANCED_POWER_ACCURACY;
- this.interval = 3600000;
- this.fastestInterval = 600000;
- this.explicitFastestInterval = false;
- this.expirationTime = Long.MAX_VALUE;
- this.numUpdates = Integer.MAX_VALUE;
- this.smallestDesplacement = 0;
- this.maxWaitTime = 0;
- }
-
- /**
- * Create a location request with default parameters.
- *
- * Default parameters are for a block accuracy, slowly updated location. It can then be
- * adjusted as required by the applications before passing to the FusedLocationProviderApi.
- *
- * @return a new location request
- */
- public static LocationRequest create() {
- return new LocationRequest();
- }
-
- /**
- * Get the request expiration time, in milliseconds since boot.
- *
- * This value can be compared to {@link SystemClock#elapsedRealtime()} to determine
- * the time until expiration.
- *
- * @return expiration time of request, in milliseconds since boot including suspend
- */
- public long getExpirationTime() {
- return expirationTime;
- }
-
- /**
- * Get the fastest interval of this request, in milliseconds.
- *
- * The system will never provide location updates faster than the minimum of
- * {@link #getFastestInterval()} and {@link #getInterval()}.
- *
- * @return fastest interval in milliseconds, exact
- */
- public long getFastestInterval() {
- return fastestInterval;
- }
-
- /**
- * Get the desired interval of this request, in milliseconds.
- *
- * @return desired interval in milliseconds, inexact
- */
- public long getInterval() {
- return interval;
- }
-
- /**
- * Get the number of updates requested.
- *
- * By default this is {@link java.lang.Integer#MAX_VALUE}, which indicates that locations are
- * updated until the request is explicitly removed.
- *
- * @return number of updates
- */
- public int getNumUpdates() {
- return numUpdates;
- }
-
- /**
- * Get the quality of the request.
- *
- * @return an accuracy constant
- */
- public int getPriority() {
- return priority;
- }
-
- /**
- * Get the minimum displacement between location updates in meters
- *
- * By default this is 0.
- *
- * @return minimum displacement between location updates in meters
- */
- public float getSmallestDesplacement() {
- return smallestDesplacement;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
-
- LocationRequest that = (LocationRequest) o;
-
- if (expirationTime != that.expirationTime)
- return false;
- if (explicitFastestInterval != that.explicitFastestInterval)
- return false;
- if (fastestInterval != that.fastestInterval)
- return false;
- if (interval != that.interval)
- return false;
- if (maxWaitTime != that.maxWaitTime)
- return false;
- if (numUpdates != that.numUpdates)
- return false;
- if (priority != that.priority)
- return false;
- if (Float.compare(that.smallestDesplacement, smallestDesplacement) != 0)
- return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return Arrays.hashCode(
- new Object[] { priority, interval, fastestInterval, explicitFastestInterval,
- explicitFastestInterval, numUpdates, smallestDesplacement, maxWaitTime
- });
- }
-
- /**
- * Set the duration of this request, in milliseconds.
- *
- * The duration begins immediately (and not when the request is passed to the location client),
- * so call this method again if the request is re-used at a later time.
- *
- * The location client will automatically stop updates after the request expires.
- *
- * The duration includes suspend time. Values less than 0 are allowed, but indicate that the
- * request has already expired.
- *
- * @param millis duration of request in milliseconds
- * @return the same object, so that setters can be chained
- */
- public LocationRequest setExpirationDuration(long millis) {
- expirationTime = SystemClock.elapsedRealtime() + millis;
- return this;
- }
-
- /**
- * Set the request expiration time, in millisecond since boot.
- *
- * This expiration time uses the same time base as {@link SystemClock#elapsedRealtime()}.
- *
- * The location client will automatically stop updates after the request expires.
- *
- * The duration includes suspend time. Values before {@link SystemClock#elapsedRealtime()} are
- * allowed, but indicate that the request has already expired.
- *
- * @param millis expiration time of request, in milliseconds since boot including suspend
- * @return the same object, so that setters can be chained
- */
- public LocationRequest setExpirationTime(long millis) {
- expirationTime = millis;
- return this;
- }
-
- /**
- * Explicitly set the fastest interval for location updates, in milliseconds.
- *
- * This controls the fastest rate at which your application will receive location updates,
- * which might be faster than {@link #setInterval(long)} in some situations (for example, if
- * other applications are triggering location updates).
- *
- * This allows your application to passively acquire locations at a rate faster than it
- * actively acquires locations, saving power.
- *
- * Unlike {@link #setInterval(long)}, this parameter is exact. Your application will never
- * receive updates faster than this value.
- *
- * If you don't call this method, a fastest interval will be selected for you. It will be a
- * value faster than your active interval ({@link #setInterval(long)}).
- *
- * An interval of 0 is allowed, but not recommended, since location updates may be extremely
- * fast on future implementations.
- *
- * If {@link #setFastestInterval(long)} is set slower than {@link #setInterval(long)}, then
- * your effective fastest interval is {@link #setInterval(long)}.
- *
- * @param millis fastest interval for updates in milliseconds, exact
- * @return the same object, so that setters can be chained
- * @throws IllegalArgumentException if the interval is less than zero
- */
- public LocationRequest setFastestInterval(long millis) throws IllegalArgumentException {
- if (millis < 0)
- throw new IllegalArgumentException("interval must not be negative");
- fastestInterval = millis;
- return this;
- }
-
- /**
- * Set the desired interval for active location updates, in milliseconds.
- *
- * The location client will actively try to obtain location updates for your application at
- * this interval, so it has a direct influence on the amount of power used by your application.
- * Choose your interval wisely.
- *
- * This interval is inexact. You may not receive updates at all (if no location sources are
- * available), or you may receive them slower than requested. You may also receive them faster
- * than requested (if other applications are requesting location at a faster interval). The
- * fastest rate that that you will receive updates can be controlled with
- * {@link #setFastestInterval(long)}. By default this fastest rate is 6x the interval frequency.
- *
- * Applications with only the coarse location permission may have their interval silently
- * throttled.
- *
- * An interval of 0 is allowed, but not recommended, since location updates may be extremely
- * fast on future implementations.
- *
- * {@link #setPriority(int)} and {@link #setInterval(long)} are the most important parameters
- * on a location request.
- *
- * @param millis desired interval in millisecond, inexact
- * @return the same object, so that setters can be chained
- * @throws IllegalArgumentException if the interval is less than zero
- */
- public LocationRequest setInterval(long millis) throws IllegalArgumentException {
- if (millis < 0)
- throw new IllegalArgumentException("interval must not be negative");
- interval = millis;
- return this;
- }
-
- /**
- * Set the number of location updates.
- *
- * By default locations are continuously updated until the request is explicitly removed,
- * however you can optionally request a set number of updates. For example, if your application
- * only needs a single fresh location, then call this method with a value of 1 before passing
- * the request to the location client.
- *
- * When using this option care must be taken to either explicitly remove the request when no
- * longer needed or to set an expiration with ({@link #setExpirationDuration(long)} or
- * {@link #setExpirationTime(long)}. Otherwise in some cases if a location can't be computed,
- * this request could stay active indefinitely consuming power.
- *
- * @param numUpdates the number of location updates requested
- * @return the same object, so that setters can be chained
- * @throws IllegalArgumentException if numUpdates is 0 or less
- */
- public LocationRequest setNumUpdates(int numUpdates) throws IllegalArgumentException {
- if (numUpdates <= 0)
- throw new IllegalArgumentException("numUpdates must not be 0 or negative");
- this.numUpdates = numUpdates;
- return this;
- }
-
- /**
- * Set the priority of the request.
- *
- * Use with a priority constant such as {@link #PRIORITY_HIGH_ACCURACY}. No other values are
- * accepted.
- *
- * The priority of the request is a strong hint to the LocationClient for which location
- * sources to use. For example, {@link #PRIORITY_HIGH_ACCURACY} is more likely to use GPS, and
- * {@link #PRIORITY_BALANCED_POWER_ACCURACY} is more likely to use WIFI & Cell tower
- * positioning, but it also depends on many other factors (such as which sources are available)
- * and is implementation dependent.
- *
- * {@link #setPriority(int)} and {@link #setInterval(long)} are the most important parameters
- * on a location request.
- *
- * @param priority an accuracy or power constant
- * @return the same object, so that setters can be chained
- * @throws IllegalArgumentException if the quality constant is not valid
- */
- public LocationRequest setPriority(int priority) {
- switch (priority) {
- default:
- throw new IllegalArgumentException("priority is not a known constant");
- case PRIORITY_BALANCED_POWER_ACCURACY:
- case PRIORITY_HIGH_ACCURACY:
- case PRIORITY_LOW_POWER:
- case PRIORITY_NO_POWER:
- this.priority = priority;
- }
- return this;
- }
-
- /**
- * Set the minimum displacement between location updates in meters
- *
- * By default this is 0.
- *
- * @param smallestDisplacementMeters the smallest displacement in meters the user must move
- * between location updates.
- * @return the same object, so that setters can be chained
- * @throws IllegalArgumentException if smallestDisplacementMeters is negative
- */
- public LocationRequest setSmallestDisplacement(float smallestDisplacementMeters) {
- if (smallestDisplacementMeters < 0)
- throw new IllegalArgumentException("smallestDisplacementMeters must not be negative");
- this.smallestDesplacement = smallestDisplacementMeters;
- return this;
- }
-
- @Override
- public String toString() {
- return "LocationRequest{" +
- "priority=" + priority +
- ", interval=" + interval +
- ", fastestInterval=" + fastestInterval +
- ", explicitFastestInterval=" + explicitFastestInterval +
- ", expirationTime=" + expirationTime +
- ", numUpdates=" + numUpdates +
- ", smallestDesplacement=" + smallestDesplacement +
- ", maxWaitTime=" + maxWaitTime +
- '}';
- }
-
- public static final Creator CREATOR = new AutoCreator(LocationRequest.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationResult.java b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationResult.java
deleted file mode 100644
index d09109fe..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationResult.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import android.location.Location;
-
-import org.microg.gms.common.PublicApi;
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-import java.util.List;
-
-@PublicApi
-public class LocationResult extends AutoSafeParcelable {
-
- @SafeParceled(1000)
- private int versionCode = 2;
-
- @SafeParceled(value = 1, subClass = Location.class)
- public final List locations;
-
- private LocationResult(List locations) {
- this.locations = locations;
- }
-
- public static LocationResult create(List locations) {
- return new LocationResult(locations);
- }
-
- public static final Creator CREATOR = new AutoCreator(LocationResult.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsRequest.java b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsRequest.java
deleted file mode 100644
index 517ab1c8..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsRequest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import org.microg.gms.common.PublicApi;
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-@PublicApi
-public class LocationSettingsRequest extends AutoSafeParcelable {
- @SafeParceled(1000)
- private int versionCode = 2;
-
- @SafeParceled(value = 1, subClass = LocationRequest.class)
- @PublicApi(exclude = true)
- public List requests;
-
- @SafeParceled(2)
- @PublicApi(exclude = true)
- public boolean alwaysShow;
-
- @PublicApi(exclude = true)
- public boolean needBle;
-
- private LocationSettingsRequest() {
- }
-
- private LocationSettingsRequest(List requests, boolean alwaysShow, boolean needBle) {
- this.requests = requests;
- this.alwaysShow = alwaysShow;
- this.needBle = needBle;
- }
-
- /**
- * A builder that builds {@link LocationSettingsRequest}.
- */
- public static class Builder {
- private List requests = new ArrayList();
- private boolean alwaysShow = false;
- private boolean needBle = false;
-
- /**
- * Adds a collection of {@link LocationRequest}s that the client is interested in. Settings
- * will be checked for optimal performance of all {@link LocationRequest}s.
- */
- public Builder addAllLocationRequests(Collection requests) {
- this.requests.addAll(requests);
- return this;
- }
-
- /**
- * Adds one {@link LocationRequest} that the client is interested in. Settings will be
- * checked for optimal performance of all {@link LocationRequest}s.
- */
- public Builder addLocationRequest(LocationRequest request) {
- requests.add(request);
- return this;
- }
-
- /**
- * Creates a LocationSettingsRequest that can be used with SettingsApi.
- */
- public LocationSettingsRequest build() {
- return new LocationSettingsRequest(requests, alwaysShow, needBle);
- }
-
- /**
- * Whether or not location is required by the calling app in order to continue. Set this to
- * true if location is required to continue and false if having location provides better
- * results, but is not required. This changes the wording/appearance of the dialog
- * accordingly.
- */
- public Builder setAlwaysShow(boolean show) {
- alwaysShow = show;
- return this;
- }
-
- /**
- * Sets whether the client wants BLE scan to be enabled. When this flag is set to true, if
- * the platform supports BLE scan mode and Bluetooth is off, the dialog will prompt the
- * user to enable BLE scan. If the platform doesn't support BLE scan mode, the dialog will
- * prompt to enable Bluetooth.
- */
- public Builder setNeedBle(boolean needBle) {
- this.needBle = needBle;
- return this;
- }
- }
-
- public static final Creator CREATOR = new AutoCreator(LocationSettingsRequest.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsResult.java b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsResult.java
deleted file mode 100644
index 4269b429..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsResult.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import com.google.android.gms.common.api.Result;
-import com.google.android.gms.common.api.Status;
-
-import org.microg.gms.common.PublicApi;
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-/**
- * Result of checking settings via checkLocationSettings(GoogleApiClient, LocationSettingsRequest),
- * indicates whether a dialog should be shown to ask the user's consent to change their settings.
- * The method getStatus() can be be used to confirm if the request was successful. If the current
- * location settings don't satisfy the app's requirements and the user has permission to change the
- * settings, the app could use startResolutionForResult(Activity, int) to start an intent to show a
- * dialog, asking for user's consent to change the settings. The current location settings states
- * can be accessed via getLocationSettingsStates(). See LocationSettingsResult for more details.
- */
-@PublicApi
-public class LocationSettingsResult extends AutoSafeParcelable implements Result {
-
- @SafeParceled(1000)
- private int versionCode = 1;
-
- @SafeParceled(1)
- private Status status;
-
- @SafeParceled(2)
- private LocationSettingsStates settings;
-
-
- /**
- * Retrieves the location settings states.
- */
- public LocationSettingsStates getLocationSettingsStates() {
- return settings;
- }
-
- @Override
- public Status getStatus() {
- return status;
- }
-
- @PublicApi(exclude = true)
- public LocationSettingsResult(LocationSettingsStates settings, Status status) {
- this.settings = settings;
- this.status = status;
- }
-
- @PublicApi(exclude = true)
- public LocationSettingsResult(Status status) {
- this.status = status;
- }
-
- public static final Creator CREATOR = new AutoCreator(LocationSettingsResult.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsStates.java b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsStates.java
deleted file mode 100644
index 194982b2..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsStates.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import org.microg.gms.common.PublicApi;
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-/**
- * Stores the current states of all location-related settings.
- */
-@PublicApi
-public class LocationSettingsStates extends AutoSafeParcelable {
-
- @SafeParceled(1000)
- private int versionCode = 2;
-
- @SafeParceled(1)
- private boolean gpsUsable;
-
- @SafeParceled(2)
- private boolean networkLocationUsable;
-
- @SafeParceled(3)
- private boolean bleUsable;
-
- @SafeParceled(4)
- private boolean gpsPresent;
-
- @SafeParceled(5)
- private boolean networkLocationPresent;
-
- @SafeParceled(6)
- private boolean blePresent;
-
- public boolean isBlePresent() {
- return blePresent;
- }
-
- public boolean isBleUsable() {
- return bleUsable;
- }
-
- public boolean isGpsPresent() {
- return gpsPresent;
- }
-
- public boolean isGpsUsable() {
- return gpsUsable;
- }
-
- public boolean isLocationPresent() {
- return isGpsPresent() || isNetworkLocationPresent();
- }
-
- public boolean isLocationUsable() {
- return isGpsUsable() || isNetworkLocationUsable();
- }
-
- public boolean isNetworkLocationPresent() {
- return networkLocationPresent;
- }
-
- public boolean isNetworkLocationUsable() {
- return networkLocationUsable;
- }
-
- public LocationSettingsStates(boolean gpsUsable, boolean networkLocationUsable, boolean bleUsable, boolean gpsPresent, boolean networkLocationPresent, boolean blePresent) {
- this.gpsUsable = gpsUsable;
- this.networkLocationUsable = networkLocationUsable;
- this.bleUsable = bleUsable;
- this.gpsPresent = gpsPresent;
- this.networkLocationPresent = networkLocationPresent;
- this.blePresent = blePresent;
- }
-
- public static final Creator CREATOR = new AutoCreator(LocationSettingsStates.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsStatusCodes.java b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsStatusCodes.java
deleted file mode 100644
index 028de68c..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsStatusCodes.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import com.google.android.gms.common.api.CommonStatusCodes;
-import com.google.android.gms.common.api.Status;
-
-import org.microg.gms.common.PublicApi;
-
-/**
- * Location settings specific status codes, for use in {@link Status#getStatusCode()}
- */
-@PublicApi
-public class LocationSettingsStatusCodes extends CommonStatusCodes {
- /**
- * Location settings can't be changed to meet the requirements, no dialog pops up
- */
- public static final int SETTINGS_CHANGE_UNAVAILABLE = 8502;
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationStatus.java b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationStatus.java
deleted file mode 100644
index 6cd2060a..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationStatus.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-import java.util.Arrays;
-
-public class LocationStatus extends AutoSafeParcelable {
- public static final int STATUS_SUCCESSFUL = 0;
- public static final int STATUS_UNKNOWN = 1;
- public static final int STATUS_TIMED_OUT_ON_SCAN = 2;
- public static final int STATUS_NO_INFO_IN_DATABASE = 3;
- public static final int STATUS_INVALID_SCAN = 4;
- public static final int STATUS_UNABLE_TO_QUERY_DATABASE = 5;
- public static final int STATUS_SCANS_DISABLED_IN_SETTINGS = 6;
- public static final int STATUS_LOCATION_DISABLED_IN_SETTINGS = 7;
- public static final int STATUS_IN_PROGRESS = 8;
- @SafeParceled(1000)
- private int versionCode = 1;
- @SafeParceled(1)
- int cellStatus;
- @SafeParceled(2)
- int wifiStatus;
- @SafeParceled(3)
- long elapsedRealtimeNanos;
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
-
- LocationStatus that = (LocationStatus) o;
-
- if (cellStatus != that.cellStatus)
- return false;
- if (elapsedRealtimeNanos != that.elapsedRealtimeNanos)
- return false;
- if (wifiStatus != that.wifiStatus)
- return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return Arrays.hashCode(new Object[] { cellStatus, wifiStatus, elapsedRealtimeNanos });
- }
-
- private String statusToString(int status) {
- switch (status) {
- case STATUS_SUCCESSFUL:
- return "STATUS_SUCCESSFUL";
- case STATUS_UNKNOWN:
- default:
- return "STATUS_UNKNOWN";
- case STATUS_TIMED_OUT_ON_SCAN:
- return "STATUS_TIMED_OUT_ON_SCAN";
- case STATUS_NO_INFO_IN_DATABASE:
- return "STATUS_NO_INFO_IN_DATABASE";
- case STATUS_INVALID_SCAN:
- return "STATUS_INVALID_SCAN";
- case STATUS_UNABLE_TO_QUERY_DATABASE:
- return "STATUS_UNABLE_TO_QUERY_DATABASE";
- case STATUS_SCANS_DISABLED_IN_SETTINGS:
- return "STATUS_SCANS_DISABLED_IN_SETTINGS";
- case STATUS_LOCATION_DISABLED_IN_SETTINGS:
- return "STATUS_LOCATION_DISABLED_IN_SETTINGS";
- case STATUS_IN_PROGRESS:
- return "STATUS_IN_PROGRESS";
- }
- }
-
- public static final Creator CREATOR = new AutoCreator(LocationStatus.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/internal/ClientIdentity.java b/play-services-location-api/src/main/java/com/google/android/gms/location/internal/ClientIdentity.java
deleted file mode 100644
index a92c6516..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/internal/ClientIdentity.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location.internal;
-
-import org.microg.safeparcel.AutoSafeParcelable;
-
-public class ClientIdentity extends AutoSafeParcelable {
- public static final Creator CREATOR = new AutoCreator(ClientIdentity.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/internal/FusedLocationProviderResult.java b/play-services-location-api/src/main/java/com/google/android/gms/location/internal/FusedLocationProviderResult.java
deleted file mode 100644
index b4b6516d..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/internal/FusedLocationProviderResult.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location.internal;
-
-import com.google.android.gms.common.api.Status;
-
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-public class FusedLocationProviderResult extends AutoSafeParcelable {
- public static final FusedLocationProviderResult SUCCESS = FusedLocationProviderResult.create(Status.SUCCESS);
-
- @SafeParceled(1000)
- private int versionCode = 1;
-
- @SafeParceled(1)
- public Status status;
-
- public static FusedLocationProviderResult create(Status status) {
- FusedLocationProviderResult result = new FusedLocationProviderResult();
- result.status = status;
- return result;
- }
-
- public static final Creator CREATOR = new AutoCreator(FusedLocationProviderResult.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/internal/LocationRequestInternal.java b/play-services-location-api/src/main/java/com/google/android/gms/location/internal/LocationRequestInternal.java
deleted file mode 100644
index c803a841..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/internal/LocationRequestInternal.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location.internal;
-
-import com.google.android.gms.location.LocationRequest;
-
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-import java.util.List;
-
-public class LocationRequestInternal extends AutoSafeParcelable {
-
- @SafeParceled(1000)
- private int versionCode = 1;
-
- @SafeParceled(1)
- public LocationRequest request;
-
- @SafeParceled(2)
- public boolean requestNlpDebugInfo;
-
- @SafeParceled(3)
- public boolean restorePendingIntentListeners;
-
- @SafeParceled(4)
- public boolean triggerUpdate;
-
- @SafeParceled(value = 5, subClass = ClientIdentity.class)
- public List clients;
-
- @SafeParceled(6)
- public String tag;
-
- @SafeParceled(7)
- public boolean hideFromAppOps;
-
- @SafeParceled(8)
- public boolean forceCoarseLocation;
-
- @Override
- public String toString() {
- return "LocationRequestInternal{" +
- "request=" + request +
- ", requestNlpDebugInfo=" + requestNlpDebugInfo +
- ", restorePendingIntentListeners=" + restorePendingIntentListeners +
- ", triggerUpdate=" + triggerUpdate +
- ", clients=" + clients +
- ", tag='" + tag + '\'' +
- ", hideFromAppOps=" + hideFromAppOps +
- ", forceCoarseLocation=" + forceCoarseLocation +
- '}';
- }
-
- public static final Creator CREATOR = new AutoCreator(LocationRequestInternal.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/internal/LocationRequestUpdateData.java b/play-services-location-api/src/main/java/com/google/android/gms/location/internal/LocationRequestUpdateData.java
deleted file mode 100644
index 6da81cc3..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/internal/LocationRequestUpdateData.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location.internal;
-
-import android.app.PendingIntent;
-
-import com.google.android.gms.location.ILocationCallback;
-import com.google.android.gms.location.ILocationListener;
-import com.google.android.gms.location.internal.IFusedLocationProviderCallback;
-
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-public class LocationRequestUpdateData extends AutoSafeParcelable {
-
- public static final int REQUEST_UPDATES = 1;
- public static final int REMOVE_UPDATES = 2;
-
- @SafeParceled(1000)
- private int versionCode;
-
- @SafeParceled(1)
- public int opCode;
-
- @SafeParceled(2)
- public LocationRequestInternal request;
-
- @SafeParceled(3)
- public ILocationListener listener;
-
- @SafeParceled(4)
- public PendingIntent pendingIntent;
-
- @SafeParceled(5)
- public ILocationCallback callback;
-
- @SafeParceled(6)
- public IFusedLocationProviderCallback fusedLocationProviderCallback;
-
- @Override
- public String toString() {
- return "LocationRequestUpdateData{" +
- "opCode=" + opCode +
- ", request=" + request +
- ", listener=" + (listener != null ? listener.asBinder() : null) +
- ", pendingIntent=" + pendingIntent +
- ", callback=" + (callback != null ? callback.asBinder() : null) +
- ", fusedLocationProviderCallback=" + (fusedLocationProviderCallback != null ? fusedLocationProviderCallback.asBinder() : null) +
- '}';
- }
-
- public static final Creator CREATOR = new AutoCreator(LocationRequestUpdateData.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/internal/ParcelableGeofence.java b/play-services-location-api/src/main/java/com/google/android/gms/location/internal/ParcelableGeofence.java
deleted file mode 100644
index 3abc611c..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/internal/ParcelableGeofence.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location.internal;
-
-import com.google.android.gms.location.Geofence;
-
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-public class ParcelableGeofence extends AutoSafeParcelable implements Geofence {
-
- @SafeParceled(1000)
- private int versionCode = 1;
-
- @SafeParceled(1)
- public String requestId;
-
- @SafeParceled(2)
- public long expirationTime;
-
- @SafeParceled(3)
- public int regionType;
-
- @SafeParceled(4)
- public double latitude;
-
- @SafeParceled(5)
- public double longitude;
-
- @SafeParceled(6)
- public float radius;
-
- @SafeParceled(7)
- public int transitionType;
-
- @SafeParceled(8)
- public int notificationResponsiveness;
-
- @SafeParceled(9)
- public int loiteringDelay;
-
- private ParcelableGeofence() {
- }
-
- public ParcelableGeofence(String requestId, long expirationTime, int regionType, double latitude, double longitude, float radius, int transitionType, int notificationResponsiveness, int loiteringDelay) {
- this.requestId = requestId;
- this.expirationTime = expirationTime;
- this.regionType = regionType;
- this.latitude = latitude;
- this.longitude = longitude;
- this.radius = radius;
- this.transitionType = transitionType;
- this.notificationResponsiveness = notificationResponsiveness;
- this.loiteringDelay = loiteringDelay;
- }
-
- @Override
- public String getRequestId() {
- return requestId;
- }
-
- public static final Creator CREATOR = new AutoCreator(ParcelableGeofence.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/places/AutocompleteFilter.java b/play-services-location-api/src/main/java/com/google/android/gms/location/places/AutocompleteFilter.java
deleted file mode 100644
index cf0f9238..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/places/AutocompleteFilter.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location.places;
-
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-/**
- * TODO usage
- */
-public class AutocompleteFilter extends AutoSafeParcelable {
-
- @SafeParceled(1000)
- private int versionCode = 1;
-
- public static final Creator CREATOR = new AutoCreator(AutocompleteFilter.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/places/NearbyAlertRequest.java b/play-services-location-api/src/main/java/com/google/android/gms/location/places/NearbyAlertRequest.java
deleted file mode 100644
index 97c7b7e8..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/places/NearbyAlertRequest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location.places;
-
-import org.microg.safeparcel.AutoSafeParcelable;
-
-/**
- * TODO: usage
- */
-public class NearbyAlertRequest extends AutoSafeParcelable {
-
- public static final Creator CREATOR = new AutoCreator(NearbyAlertRequest.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/places/Place.java b/play-services-location-api/src/main/java/com/google/android/gms/location/places/Place.java
deleted file mode 100644
index 25ad8f3f..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/places/Place.java
+++ /dev/null
@@ -1,384 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location.places;
-
-import android.net.Uri;
-
-import com.google.android.gms.common.data.Freezable;
-import com.google.android.gms.maps.model.LatLng;
-import com.google.android.gms.maps.model.LatLngBounds;
-
-import java.util.List;
-import java.util.Locale;
-
-public interface Place extends Freezable {
- int TYPE_ACCOUNTING = 1;
-
- int TYPE_ADMINISTRATIVE_AREA_LEVEL_1 = 1001;
-
- int TYPE_ADMINISTRATIVE_AREA_LEVEL_2 = 1002;
-
- int TYPE_ADMINISTRATIVE_AREA_LEVEL_3 = 1003;
-
- int TYPE_AIRPORT = 2;
-
- int TYPE_AMUSEMENT_PARK = 3;
-
- int TYPE_AQUARIUM = 4;
-
- int TYPE_ART_GALLERY = 5;
-
- int TYPE_ATM = 6;
-
- int TYPE_BAKERY = 7;
-
- int TYPE_BANK = 8;
-
- int TYPE_BAR = 9;
-
- int TYPE_BEAUTY_SALON = 10;
-
- int TYPE_BICYCLE_STORE = 11;
-
- int TYPE_BOOK_STORE = 12;
-
- int TYPE_BOWLING_ALLEY = 13;
-
- int TYPE_BUS_STATION = 14;
-
- int TYPE_CAFE = 15;
-
- int TYPE_CAMPGROUND = 16;
-
- int TYPE_CAR_DEALER = 17;
-
- int TYPE_CAR_RENTAL = 18;
-
- int TYPE_CAR_REPAIR = 19;
-
- int TYPE_CAR_WASH = 20;
-
- int TYPE_CASINO = 21;
-
- int TYPE_CEMETERY = 22;
-
- int TYPE_CHURCH = 23;
-
- int TYPE_CITY_HALL = 24;
-
- int TYPE_CLOTHING_STORE = 25;
-
- int TYPE_COLLOQUIAL_AREA = 1004;
-
- int TYPE_CONVENIENCE_STORE = 26;
-
- int TYPE_COUNTRY = 1005;
-
- int TYPE_COURTHOUSE = 27;
-
- int TYPE_DENTIST = 28;
-
- int TYPE_DEPARTMENT_STORE = 29;
-
- int TYPE_DOCTOR = 30;
-
- int TYPE_ELECTRICIAN = 31;
-
- int TYPE_ELECTRONICS_STORE = 32;
-
- int TYPE_EMBASSY = 33;
-
- int TYPE_ESTABLISHMENT = 34;
-
- int TYPE_FINANCE = 35;
-
- int TYPE_FIRE_STATION = 36;
-
- int TYPE_FLOOR = 1006;
-
- int TYPE_FLORIST = 37;
-
- int TYPE_FOOD = 38;
-
- int TYPE_FUNERAL_HOME = 39;
-
- int TYPE_FURNITURE_STORE = 40;
-
- int TYPE_GAS_STATION = 41;
-
- int TYPE_GENERAL_CONTRACTOR = 42;
-
- int TYPE_GEOCODE = 1007;
-
- int TYPE_GROCERY_OR_SUPERMARKET = 43;
-
- int TYPE_GYM = 44;
-
- int TYPE_HAIR_CARE = 45;
-
- int TYPE_HARDWARE_STORE = 46;
-
- int TYPE_HEALTH = 47;
-
- int TYPE_HINDU_TEMPLE = 48;
-
- int TYPE_HOME_GOODS_STORE = 49;
-
- int TYPE_HOSPITAL = 50;
-
- int TYPE_INSURANCE_AGENCY = 51;
-
- int TYPE_INTERSECTION = 1008;
-
- int TYPE_JEWELRY_STORE = 52;
-
- int TYPE_LAUNDRY = 53;
-
- int TYPE_LAWYER = 54;
-
- int TYPE_LIBRARY = 55;
-
- int TYPE_LIQUOR_STORE = 56;
-
- int TYPE_LOCALITY = 1009;
-
- int TYPE_LOCAL_GOVERNMENT_OFFICE = 57;
-
- int TYPE_LOCKSMITH = 58;
-
- int TYPE_LODGING = 59;
-
- int TYPE_MEAL_DELIVERY = 60;
-
- int TYPE_MEAL_TAKEAWAY = 61;
-
- int TYPE_MOSQUE = 62;
-
- int TYPE_MOVIE_RENTAL = 63;
-
- int TYPE_MOVIE_THEATER = 64;
-
- int TYPE_MOVING_COMPANY = 65;
-
- int TYPE_MUSEUM = 66;
-
- int TYPE_NATURAL_FEATURE = 1010;
-
- int TYPE_NEIGHBORHOOD = 1011;
-
- int TYPE_NIGHT_CLUB = 67;
-
- int TYPE_OTHER = 0;
-
- int TYPE_PAINTER = 68;
-
- int TYPE_PARK = 69;
-
- int TYPE_PARKING = 70;
-
- int TYPE_PET_STORE = 71;
-
- int TYPE_PHARMACY = 72;
-
- int TYPE_PHYSIOTHERAPIST = 73;
-
- int TYPE_PLACE_OF_WORSHIP = 74;
-
- int TYPE_PLUMBER = 75;
-
- int TYPE_POINT_OF_INTEREST = 1013;
-
- int TYPE_POLICE = 76;
-
- int TYPE_POLITICAL = 1012;
-
- int TYPE_POSTAL_CODE = 1015;
-
- int TYPE_POSTAL_CODE_PREFIX = 1016;
-
- int TYPE_POSTAL_TOWN = 1017;
-
- int TYPE_POST_BOX = 1014;
-
- int TYPE_POST_OFFICE = 77;
-
- int TYPE_PREMISE = 1018;
-
- int TYPE_REAL_ESTATE_AGENCY = 78;
-
- int TYPE_RESTAURANT = 79;
-
- int TYPE_ROOFING_CONTRACTOR = 80;
-
- int TYPE_ROOM = 1019;
-
- int TYPE_ROUTE = 1020;
-
- int TYPE_RV_PARK = 81;
-
- int TYPE_SCHOOL = 82;
-
- int TYPE_SHOE_STORE = 83;
-
- int TYPE_SHOPPING_MALL = 84;
-
- int TYPE_SPA = 85;
-
- int TYPE_STADIUM = 86;
-
- int TYPE_STORAGE = 87;
-
- int TYPE_STORE = 88;
-
- int TYPE_STREET_ADDRESS = 1021;
-
- int TYPE_SUBLOCALITY = 1022;
-
- int TYPE_SUBLOCALITY_LEVEL_1 = 1023;
-
- int TYPE_SUBLOCALITY_LEVEL_2 = 1024;
-
- int TYPE_SUBLOCALITY_LEVEL_3 = 1025;
-
- int TYPE_SUBLOCALITY_LEVEL_4 = 1026;
-
- int TYPE_SUBLOCALITY_LEVEL_5 = 1027;
-
- int TYPE_SUBPREMISE = 1028;
-
- int TYPE_SUBWAY_STATION = 89;
-
- int TYPE_SYNAGOGUE = 90;
-
- int TYPE_SYNTHETIC_GEOCODE = 1029;
-
- int TYPE_TAXI_STAND = 91;
-
- int TYPE_TRAIN_STATION = 92;
-
- int TYPE_TRANSIT_STATION = 1030;
-
- int TYPE_TRAVEL_AGENCY = 93;
-
- int TYPE_UNIVERSITY = 94;
-
- int TYPE_VETERINARY_CARE = 95;
-
- int TYPE_ZOO = 96;
-
- /**
- * Returns a human readable address for this Place. May return null if the address is unknown.
- *
- * The address is localized according to the locale returned by {@link com.google.android.gms.location.places.Place#getLocale()}.
- */
- CharSequence getAddress();
-
- /**
- * Returns the attributions to be shown to the user if data from the {@link com.google.android.gms.location.places.Place} is used.
- *
- * We recommend placing this information below any place information. See
- * Displaying Attributions for more details.
- *
- * @return The attributions in HTML format, or null if there are no attributions to display.
- */
- CharSequence getAttributions();
-
- /**
- * Returns the unique id of this Place.
- *
- * This ID can be passed to {@link com.google.android.gms.location.places.GeoDataApi#getPlaceById(com.google.android.gms.common.api.GoogleApiClient, java.lang.String...)} to lookup the same place at a later
- * time, but it is not guaranteed that such a lookup will succeed (the place may no longer exist
- * in our database). It is possible that the returned Place in such a lookup will have a
- * different ID (so there may be multiple ID's for one given place).
- */
- String getId();
-
- /**
- * Returns the location of this Place.
- *
- * The location is not necessarily the center of the Place, or any particular entry or exit
- * point, but some arbitrarily chosen point within the geographic extent of the Place.
- */
- LatLng getLatLng();
-
- /**
- * Returns the locale in which the names and addresses were localized.
- */
- Locale getLocale();
-
- /**
- * Returns the name of this Place.
- *
- * The name is localized according to the locale returned by {@link com.google.android.gms.location.places.Place#getLocale()}.
- */
- CharSequence getName();
-
- /**
- * Returns the place's phone number in international format. Returns null if no phone number is
- * known, or the place has no phone number.
- *
- * International format includes the country code, and is prefixed with the plus (+) sign. For
- * example, the international phone number for Google's Mountain View, USA office is +1
- * 650-253-0000.
- */
- CharSequence getPhoneNumber();
-
- /**
- * Returns a list of place types for this Place.
- *
- * The elements of this list are drawn from Place.TYPE_*
constants, though one should
- * expect there could be new place types returned that were introduced after an app was
- * published.
- */
- List getPlaceTypes();
-
- /**
- * Returns the price level for this place on a scale from 0 (cheapest) to 4.
- *
- * If no price level is known, a negative value is returned.
- *
- * The price level of the place, on a scale of 0 to 4. The exact amount indicated by a specific
- * value will vary from region to region. Price levels are interpreted as follows:
- */
- int getPriceLevel();
-
- /**
- * Returns the place's rating, from 1.0 to 5.0, based on aggregated user reviews.
- *
- * If no rating is known, a negative value is returned.
- */
- float getRating();
-
- /**
- * Returns a viewport for displaying this Place. May return null if the size of the place is not
- * known.
- *
- * This returns a viewport of a size that is suitable for displaying this Place. For example, a
- * Place representing a store may have a relatively small viewport, while a Place representing a
- * country may have a very large viewport.
- */
- LatLngBounds getViewport();
-
- /**
- * Returns the URI of the website of this Place. Returns null if no website is known.
- *
- * This is the URI of the website maintained by the Place, if available. Note this is a
- * third-party website not affiliated with the Places API.
- */
- Uri getWebsiteUri();
-
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceFilter.java b/play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceFilter.java
deleted file mode 100644
index 22bffb6b..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceFilter.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location.places;
-
-import org.microg.safeparcel.AutoSafeParcelable;
-
-/**
- * TODO: usage
- */
-public class PlaceFilter extends AutoSafeParcelable {
-
- public static final Creator CREATOR = new AutoCreator(PlaceFilter.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceReport.java b/play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceReport.java
deleted file mode 100644
index 5919e691..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceReport.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location.places;
-
-import org.microg.gms.common.PublicApi;
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-@PublicApi
-public class PlaceReport extends AutoSafeParcelable {
- @SafeParceled(1)
- private int versionCode;
- @SafeParceled(2)
- private String placeId;
- @SafeParceled(3)
- private String tag;
- @SafeParceled(4)
- private String source;
-
- public String getPlaceId() {
- return placeId;
- }
-
- public String getTag() {
- return tag;
- }
-
- public static final Creator CREATOR = new AutoCreator(PlaceReport.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceRequest.java b/play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceRequest.java
deleted file mode 100644
index ed6a8556..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/places/PlaceRequest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location.places;
-
-import org.microg.safeparcel.AutoSafeParcelable;
-
-/**
- * TODO: usage
- */
-public class PlaceRequest extends AutoSafeParcelable {
- public static final Creator CREATOR = new AutoCreator(PlaceRequest.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/places/UserAddedPlace.java b/play-services-location-api/src/main/java/com/google/android/gms/location/places/UserAddedPlace.java
deleted file mode 100644
index eb916696..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/places/UserAddedPlace.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location.places;
-
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-/**
- * TODO: usage
- */
-public class UserAddedPlace extends AutoSafeParcelable {
-
- @SafeParceled(1000)
- private int versionCode = 1;
-
- public static final Creator CREATOR = new AutoCreator(UserAddedPlace.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/places/UserDataType.java b/play-services-location-api/src/main/java/com/google/android/gms/location/places/UserDataType.java
deleted file mode 100644
index 2e8776fd..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/places/UserDataType.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location.places;
-
-import org.microg.safeparcel.AutoSafeParcelable;
-
-/**
- * TODO: usage
- */
-public class UserDataType extends AutoSafeParcelable {
-
- public static final Creator CREATOR = new AutoCreator(UserDataType.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/places/internal/PlaceImpl.java b/play-services-location-api/src/main/java/com/google/android/gms/location/places/internal/PlaceImpl.java
deleted file mode 100644
index dbc23035..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/places/internal/PlaceImpl.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location.places.internal;
-
-import android.net.Uri;
-import android.os.Bundle;
-
-import com.google.android.gms.location.places.Place;
-import com.google.android.gms.maps.model.LatLng;
-import com.google.android.gms.maps.model.LatLngBounds;
-
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Locale;
-
-public class PlaceImpl extends AutoSafeParcelable implements Place {
- @SafeParceled(1000)
- private int versionCode = 2;
- @SafeParceled(1)
- public String id;
- @SafeParceled(2)
- public Bundle addressComponents;
- @SafeParceled(4)
- public LatLng latLng;
- @SafeParceled(5)
- public float levelNumber;
- @SafeParceled(6)
- public LatLngBounds viewport;
- @SafeParceled(7)
- public String timezoneId;
- @SafeParceled(8)
- public Uri websiteUri;
- @SafeParceled(9)
- public boolean isPermanentlyClosed;
- @SafeParceled(10)
- public float rating;
- @SafeParceled(11)
- public int priceLevel;
- @SafeParceled(12)
- public long timestampSecs;
- @SafeParceled(value = 13, subClass = Integer.class)
- public List typesDeprecated = new ArrayList();
- @SafeParceled(14)
- public String address;
- @SafeParceled(15)
- public String phoneNumber;
- @SafeParceled(16)
- public String regularOpenHours;
- @SafeParceled(value = 17, subClass = String.class)
- public List attributions = new ArrayList();
- @SafeParceled(19)
- public String name;
- @SafeParceled(value = 20, subClass = Integer.class)
- public List placeTypes = new ArrayList();
-
- @Override
- public CharSequence getAddress() {
- return address;
- }
-
- @Override
- public CharSequence getAttributions() {
- return Arrays.toString(attributions.toArray());
- }
-
- @Override
- public String getId() {
- return id;
- }
-
- @Override
- public LatLng getLatLng() {
- return latLng;
- }
-
- @Override
- public Locale getLocale() {
- return Locale.getDefault();
- }
-
- @Override
- public CharSequence getName() {
- return name;
- }
-
- @Override
- public CharSequence getPhoneNumber() {
- return phoneNumber;
- }
-
- @Override
- public List getPlaceTypes() {
- return placeTypes;
- }
-
- @Override
- public int getPriceLevel() {
- return priceLevel;
- }
-
- @Override
- public float getRating() {
- return rating;
- }
-
- @Override
- public LatLngBounds getViewport() {
- return viewport;
- }
-
- @Override
- public Uri getWebsiteUri() {
- return websiteUri;
- }
-
- @Override
- public Place freeze() {
- return this;
- }
-
- @Override
- public boolean isDataValid() {
- return true;
- }
-
- public static final Creator CREATOR = new AutoSafeParcelable.AutoCreator(PlaceImpl.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/places/internal/PlacesParams.java b/play-services-location-api/src/main/java/com/google/android/gms/location/places/internal/PlacesParams.java
deleted file mode 100644
index eb365fa3..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/places/internal/PlacesParams.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location.places.internal;
-
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-public class PlacesParams extends AutoSafeParcelable {
-
- @SafeParceled(1000)
- private int versionCode = 1;
- @SafeParceled(1)
- public final String clientPackageName;
- @SafeParceled(2)
- public final String locale;
- @SafeParceled(3)
- public final String accountName;
- @SafeParceled(4)
- public final String gCoreClientName;
-
- private PlacesParams() {
- clientPackageName = locale = accountName = gCoreClientName = null;
- }
-
- public static final Creator CREATOR = new AutoCreator(PlacesParams.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/reporting/ReportingState.java b/play-services-location-api/src/main/java/com/google/android/gms/location/reporting/ReportingState.java
deleted file mode 100644
index 1a223471..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/reporting/ReportingState.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location.reporting;
-
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-public class ReportingState extends AutoSafeParcelable {
- @SafeParceled(1)
- public int versionCode = 2;
- @SafeParceled(2)
- public int reportingEnabled;
- @SafeParceled(3)
- public int historyEnabled;
- @SafeParceled(4)
- public boolean allowed;
- @SafeParceled(5)
- public boolean active;
- @SafeParceled(6)
- public boolean defer;
- @SafeParceled(7)
- public int expectedOptInResult;
- @SafeParceled(8)
- public Integer deviceTag;
- @SafeParceled(9)
- public int expectedOptInResultAssumingLocationEnabled;
-
- public static final Creator CREATOR = new AutoCreator(ReportingState.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/reporting/UploadRequest.java b/play-services-location-api/src/main/java/com/google/android/gms/location/reporting/UploadRequest.java
deleted file mode 100644
index d3896f3c..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/reporting/UploadRequest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location.reporting;
-
-import android.accounts.Account;
-
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-public class UploadRequest extends AutoSafeParcelable {
- @SafeParceled(1)
- public int versionCode = 1;
- @SafeParceled(2)
- public Account account;
- @SafeParceled(3)
- public String reason;
- @SafeParceled(4)
- public long durationMillis;
- @SafeParceled(5)
- public long movingLatencyMillis;
- @SafeParceled(6)
- public long stationaryLatencyMillis;
- @SafeParceled(7)
- public String appSpecificKey;
-
- public static final Creator CREATOR = new AutoCreator(UploadRequest.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/reporting/UploadRequestResult.java b/play-services-location-api/src/main/java/com/google/android/gms/location/reporting/UploadRequestResult.java
deleted file mode 100644
index 2937a81c..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/location/reporting/UploadRequestResult.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location.reporting;
-
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-public class UploadRequestResult extends AutoSafeParcelable {
- @SafeParceled(1)
- public int versionCode = 1;
- @SafeParceled(2)
- public int resultCode;
- @SafeParceled(3)
- public long requestId;
-
- public UploadRequestResult() {
- }
-
- public static final Creator CREATOR = new AutoCreator(UploadRequestResult.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/maps/model/LatLng.java b/play-services-location-api/src/main/java/com/google/android/gms/maps/model/LatLng.java
deleted file mode 100644
index 545d8b46..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/maps/model/LatLng.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.maps.model;
-
-import org.microg.gms.common.PublicApi;
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-/**
- * An immutable class representing a pair of latitude and longitude coordinates, stored as degrees.
- */
-@PublicApi
-public final class LatLng extends AutoSafeParcelable {
- @SafeParceled(1)
- private int versionCode = 1;
- /**
- * Latitude, in degrees. This value is in the range [-90, 90].
- */
- @SafeParceled(2)
- public final double latitude;
- /**
- * Longitude, in degrees. This value is in the range [-180, 180).
- */
- @SafeParceled(3)
- public final double longitude;
-
- /**
- * This constructor is dirty setting the final fields to make the compiler happy.
- * In fact, those are replaced by their real values later using SafeParcelUtil.
- */
- private LatLng() {
- latitude = longitude = 0;
- }
-
- /**
- * Constructs a LatLng with the given latitude and longitude, measured in degrees.
- *
- * @param latitude The point's latitude. This will be clamped to between -90 degrees and
- * +90 degrees inclusive.
- * @param longitude The point's longitude. This will be normalized to be within -180 degrees
- * inclusive and +180 degrees exclusive.
- */
- public LatLng(double latitude, double longitude) {
- this.latitude = Math.max(-90, Math.min(90, latitude));
- if ((-180 <= longitude) && (longitude < 180)) {
- this.longitude = longitude;
- } else {
- this.longitude = ((360 + (longitude - 180) % 360) % 360 - 180);
- }
- }
-
- /**
- * Tests if this LatLng is equal to another.
- *
- * Two points are considered equal if and only if their latitudes are bitwise equal and their
- * longitudes are bitwise equal. This means that two {@link LatLng}s that are very near, in
- * terms of geometric distance, might not be considered {@code .equal()}.
- */
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
-
- LatLng latLng = (LatLng) o;
-
- if (Double.compare(latLng.latitude, latitude) != 0)
- return false;
- if (Double.compare(latLng.longitude, longitude) != 0)
- return false;
-
- return true;
- }
-
- @Override
- public final int hashCode() {
- long tmp1 = Double.doubleToLongBits(latitude);
- int tmp2 = 31 + (int) (tmp1 ^ tmp1 >>> 32);
- tmp1 = Double.doubleToLongBits(longitude);
- return tmp2 * 31 + (int) (tmp1 ^ tmp1 >>> 32);
- }
-
- @Override
- public String toString() {
- return "lat/lng: (" + latitude + "," + longitude + ")";
- }
-
- public static Creator CREATOR = new AutoCreator(LatLng.class);
-}
diff --git a/play-services-location-api/src/main/java/com/google/android/gms/maps/model/LatLngBounds.java b/play-services-location-api/src/main/java/com/google/android/gms/maps/model/LatLngBounds.java
deleted file mode 100644
index 21177235..00000000
--- a/play-services-location-api/src/main/java/com/google/android/gms/maps/model/LatLngBounds.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.maps.model;
-
-import org.microg.gms.common.PublicApi;
-import org.microg.safeparcel.AutoSafeParcelable;
-import org.microg.safeparcel.SafeParceled;
-
-import java.util.Arrays;
-
-/**
- * An immutable class representing a latitude/longitude aligned rectangle.
- */
-@PublicApi
-public final class LatLngBounds extends AutoSafeParcelable {
- @SafeParceled(1)
- private int versionCode = 1;
- /**
- * Southwest corner of the bound.
- */
- @SafeParceled(2)
- public final LatLng southwest;
- /**
- * Northeast corner of the bound.
- */
- @SafeParceled(3)
- public final LatLng northeast;
-
- /**
- * This constructor is dirty setting the final fields to make the compiler happy.
- * In fact, those are replaced by their real values later using SafeParcelUtil.
- */
- private LatLngBounds() {
- southwest = northeast = null;
- }
-
- /**
- * Creates a new bounds based on a southwest and a northeast corner.
- *
- * The bounds conceptually includes all points where:
- *
- * - 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
deleted file mode 100644
index fc256bc6..00000000
--- a/play-services-location-api/src/main/java/org/microg/gms/location/LocationConstants.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.location;
-
-public class LocationConstants {
- public static final String KEY_MOCK_LOCATION = "mockLocation";
-
- // Place picker client->service
- public static final String EXTRA_PRIMARY_COLOR = "primary_color";
- public static final String EXTRA_PRIMARY_COLOR_DARK = "primary_color_dark";
- public static final String EXTRA_CLIENT_VERSION = "gmscore_client_jar_version";
- public static final String EXTRA_BOUNDS = "latlng_bounds";
-
- // Place picker service->client
- public static final String EXTRA_ATTRIBUTION = "third_party_attributions";
- public static final String EXTRA_FINAL_BOUNDS = "final_latlng_bounds";
- public static final String EXTRA_PLACE = "selected_place";
- public static final String EXTRA_STATUS = "status";
-}
diff --git a/play-services-location-core/build.gradle b/play-services-location-core/build.gradle
deleted file mode 100644
index 0556c781..00000000
--- a/play-services-location-core/build.gradle
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2020, microG Project Team
- * SPDX-License-Identifier: Apache-2.0
- */
-
-apply plugin: 'com.android.library'
-apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-android-extensions'
-
-dependencies {
- api project(':play-services-location-api')
-
- implementation project(':play-services-base-core')
- implementation "org.microg.nlp:geocode-v1:$nlpVersion"
- implementation "org.microg.nlp:location-v2:$nlpVersion"
- implementation "org.microg.nlp:location-v3:$nlpVersion"
- implementation "org.microg.nlp:service:$nlpVersion"
- implementation "org.microg.nlp:client:$nlpVersion"
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
- implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutineVersion"
- implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutineVersion"
- api "org.microg.nlp:ui:$nlpVersion"
-}
-
-android {
- compileSdkVersion androidCompileSdk
- buildToolsVersion "$androidBuildVersionTools"
-
- defaultConfig {
- versionName version
- minSdkVersion androidMinSdk
- targetSdkVersion androidTargetSdk
- }
-
- compileOptions {
- sourceCompatibility = 1.8
- targetCompatibility = 1.8
- }
-}
diff --git a/play-services-location-core/src/main/AndroidManifest.xml b/play-services-location-core/src/main/AndroidManifest.xml
deleted file mode 100644
index 4786a8e7..00000000
--- a/play-services-location-core/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/play-services-location-core/src/main/java/org/microg/gms/location/GoogleLocationManager.java b/play-services-location-core/src/main/java/org/microg/gms/location/GoogleLocationManager.java
deleted file mode 100644
index ae767666..00000000
--- a/play-services-location-core/src/main/java/org/microg/gms/location/GoogleLocationManager.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.location;
-
-import android.Manifest;
-import android.app.PendingIntent;
-import android.content.Context;
-import android.location.Location;
-import android.location.LocationManager;
-import android.os.Binder;
-import android.os.RemoteException;
-
-import com.google.android.gms.location.ILocationListener;
-import com.google.android.gms.location.LocationRequest;
-import com.google.android.gms.location.internal.FusedLocationProviderResult;
-import com.google.android.gms.location.internal.LocationRequestUpdateData;
-
-import org.microg.gms.common.PackageUtils;
-import org.microg.gms.common.Utils;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static android.Manifest.permission.ACCESS_COARSE_LOCATION;
-import static android.Manifest.permission.ACCESS_FINE_LOCATION;
-import static android.content.pm.PackageManager.PERMISSION_GRANTED;
-import static android.location.LocationManager.GPS_PROVIDER;
-import static android.location.LocationManager.NETWORK_PROVIDER;
-import static com.google.android.gms.location.LocationRequest.PRIORITY_HIGH_ACCURACY;
-import static com.google.android.gms.location.LocationRequest.PRIORITY_NO_POWER;
-
-public class GoogleLocationManager implements LocationChangeListener {
- private static final String TAG = "GmsLocManager";
- private static final String MOCK_PROVIDER = "mock";
- private static final long SWITCH_ON_FRESHNESS_CLIFF_MS = 30000; // 30 seconds
- private static final String ACCESS_MOCK_LOCATION = "android.permission.ACCESS_MOCK_LOCATION";
-
- private final Context context;
- private final RealLocationProvider gpsProvider;
- private final UnifiedLocationProvider networkProvider;
- private final MockLocationProvider mockProvider;
- private final List currentRequests = new ArrayList();
-
- public GoogleLocationManager(Context context) {
- this.context = context;
- LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
- if (Utils.hasSelfPermissionOrNotify(context, Manifest.permission.ACCESS_FINE_LOCATION)) {
- this.gpsProvider = new RealLocationProvider(locationManager, GPS_PROVIDER, this);
- } else {
- this.gpsProvider = null;
- }
- if (Utils.hasSelfPermissionOrNotify(context, Manifest.permission.ACCESS_COARSE_LOCATION)) {
- if (locationManager.getAllProviders().contains(NETWORK_PROVIDER)) {
- this.networkProvider = new UnifiedLocationProvider(context, this);
- } else {
- // TODO: Add ability to directly contact UnifiedNlp without the system location provider
- this.networkProvider = null;
- }
- } else {
- this.networkProvider = null;
- }
- mockProvider = new MockLocationProvider(this);
- }
-
- public Location getLastLocation(String packageName) {
- return getLocation(hasFineLocationPermission(), hasCoarseLocationPermission());
- }
-
- public Location getLocation(boolean gpsPermission, boolean networkPermission) {
- if (mockProvider.getLocation() != null)
- return mockProvider.getLocation();
- if (gpsPermission) {
- Location network = networkProvider == null ? null : networkProvider.getLastLocation();
- Location gps = gpsProvider == null ? null : gpsProvider.getLastLocation();
- if (network == null)
- return gps;
- if (gps == null)
- return network;
- if (gps.getTime() > network.getTime() - SWITCH_ON_FRESHNESS_CLIFF_MS)
- return gps;
- return network;
- } else if (networkPermission) {
- Location network = networkProvider == null ? null : networkProvider.getLastLocation();
- if (network != null && network.getExtras() != null && network.getExtras().getParcelable("no_gps_location") instanceof Location) {
- network = network.getExtras().getParcelable("no_gps_location");
- }
- return network;
- }
- return null;
- }
-
- private boolean hasCoarseLocationPermission() {
- return context.checkCallingPermission(ACCESS_COARSE_LOCATION) == PERMISSION_GRANTED || hasFineLocationPermission();
- }
-
- private boolean hasFineLocationPermission() {
- return context.checkCallingPermission(ACCESS_FINE_LOCATION) == PERMISSION_GRANTED;
- }
-
- private boolean hasMockLocationPermission() {
- return context.checkCallingPermission(ACCESS_MOCK_LOCATION) == PERMISSION_GRANTED;
- }
-
- private void requestLocationUpdates(LocationRequestHelper request) {
- LocationRequestHelper old = null;
- for (LocationRequestHelper req : currentRequests) {
- if (req.respondsTo(request.pendingIntent) || req.respondsTo(request.listener) || req.respondsTo(request.callback)) {
- old = req;
- break;
- }
- }
- if (old != null) {
- currentRequests.remove(old);
- }
- currentRequests.add(request);
- if (gpsProvider != null && request.hasFinePermission() && request.locationRequest.getPriority() == PRIORITY_HIGH_ACCURACY) {
- gpsProvider.addRequest(request);
- } else if (gpsProvider != null && old != null) {
- gpsProvider.removeRequest(old);
- }
- if (networkProvider != null && request.hasCoarsePermission() && request.locationRequest.getPriority() != PRIORITY_NO_POWER) {
- networkProvider.addRequest(request);
- } else if (networkProvider != null && old != null) {
- networkProvider.removeRequest(old);
- }
- }
-
- public void requestLocationUpdates(LocationRequest request, ILocationListener listener, String packageName) {
- requestLocationUpdates(new LocationRequestHelper(context, request, packageName, Binder.getCallingUid(), listener));
- }
-
- public void requestLocationUpdates(LocationRequest request, PendingIntent intent, String packageName) {
- requestLocationUpdates(new LocationRequestHelper(context, request, packageName, Binder.getCallingUid(), intent));
- }
-
- private void removeLocationUpdates(LocationRequestHelper request) {
- currentRequests.remove(request);
- if (gpsProvider != null) gpsProvider.removeRequest(request);
- if (networkProvider != null) networkProvider.removeRequest(request);
- }
-
- public void removeLocationUpdates(ILocationListener listener, String packageName) {
- for (int i = 0; i < currentRequests.size(); i++) {
- if (currentRequests.get(i).respondsTo(listener)) {
- removeLocationUpdates(currentRequests.get(i));
- i--;
- }
- }
- }
-
- public void removeLocationUpdates(PendingIntent intent, String packageName) {
- for (int i = 0; i < currentRequests.size(); i++) {
- if (currentRequests.get(i).respondsTo(intent)) {
- removeLocationUpdates(currentRequests.get(i));
- i--;
- }
- }
- }
-
- public void updateLocationRequest(LocationRequestUpdateData data) {
- String packageName = PackageUtils.getCallingPackage(context);
- if (data.pendingIntent != null)
- packageName = PackageUtils.packageFromPendingIntent(data.pendingIntent);
- if (data.opCode == LocationRequestUpdateData.REQUEST_UPDATES) {
- requestLocationUpdates(new LocationRequestHelper(context, packageName, Binder.getCallingUid(), data));
- } else if (data.opCode == LocationRequestUpdateData.REMOVE_UPDATES) {
- for (int i = 0; i < currentRequests.size(); i++) {
- if (currentRequests.get(i).respondsTo(data.listener)
- || currentRequests.get(i).respondsTo(data.pendingIntent)
- || currentRequests.get(i).respondsTo(data.callback)) {
- removeLocationUpdates(currentRequests.get(i));
- i--;
- }
- }
- }
- if (data.fusedLocationProviderCallback != null) {
- try {
- data.fusedLocationProviderCallback.onFusedLocationProviderResult(FusedLocationProviderResult.SUCCESS);
- } catch (RemoteException ignored) {
- }
- }
- }
-
- public void setMockMode(boolean mockMode) {
- if (!hasMockLocationPermission())
- return;
- mockProvider.setMockEnabled(mockMode);
- }
-
- public void setMockLocation(Location mockLocation) {
- if (!hasMockLocationPermission())
- return;
- mockProvider.setLocation(mockLocation);
- }
-
- @Override
- public void onLocationChanged() {
- for (int i = 0; i < currentRequests.size(); i++) {
- LocationRequestHelper request = currentRequests.get(i);
- if (!request.report(getLocation(request.initialHasFinePermission, request.initialHasCoarsePermission))) {
- removeLocationUpdates(request);
- i--;
- }
- }
- }
-}
diff --git a/play-services-location-core/src/main/java/org/microg/gms/location/GoogleLocationManagerService.java b/play-services-location-core/src/main/java/org/microg/gms/location/GoogleLocationManagerService.java
deleted file mode 100644
index 1a105150..00000000
--- a/play-services-location-core/src/main/java/org/microg/gms/location/GoogleLocationManagerService.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.location;
-
-import android.os.RemoteException;
-
-import com.google.android.gms.common.internal.GetServiceRequest;
-import com.google.android.gms.common.internal.IGmsCallbacks;
-
-import org.microg.gms.BaseService;
-import org.microg.gms.common.GmsService;
-
-public class GoogleLocationManagerService extends BaseService {
- private GoogleLocationManagerServiceImpl impl = new GoogleLocationManagerServiceImpl(this);
-
- public GoogleLocationManagerService() {
- super("GmsLocManagerSvc", GmsService.LOCATION_MANAGER, GmsService.GEODATA, GmsService.PLACE_DETECTION);
- }
-
- @Override
- public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException {
- callback.onPostInitComplete(0, impl.asBinder(), null);
- }
-}
diff --git a/play-services-location-core/src/main/java/org/microg/gms/location/GoogleLocationManagerServiceImpl.java b/play-services-location-core/src/main/java/org/microg/gms/location/GoogleLocationManagerServiceImpl.java
deleted file mode 100644
index 31ac74a3..00000000
--- a/play-services-location-core/src/main/java/org/microg/gms/location/GoogleLocationManagerServiceImpl.java
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.location;
-
-import android.app.PendingIntent;
-import android.content.Context;
-import android.location.Location;
-import android.os.Binder;
-import android.os.IBinder;
-import android.os.Parcel;
-import android.os.RemoteException;
-import android.util.Log;
-
-import com.google.android.gms.common.api.Status;
-import com.google.android.gms.location.ActivityRecognitionResult;
-import com.google.android.gms.location.GeofencingRequest;
-import com.google.android.gms.location.GestureRequest;
-import com.google.android.gms.location.ILocationListener;
-import com.google.android.gms.location.LocationAvailability;
-import com.google.android.gms.location.LocationRequest;
-import com.google.android.gms.location.LocationSettingsRequest;
-import com.google.android.gms.location.LocationSettingsResult;
-import com.google.android.gms.location.LocationSettingsStates;
-import com.google.android.gms.location.internal.IGeofencerCallbacks;
-import com.google.android.gms.location.internal.IGoogleLocationManagerService;
-import com.google.android.gms.location.internal.ISettingsCallbacks;
-import com.google.android.gms.location.internal.LocationRequestInternal;
-import com.google.android.gms.location.internal.LocationRequestUpdateData;
-import com.google.android.gms.location.internal.ParcelableGeofence;
-import com.google.android.gms.location.places.AutocompleteFilter;
-import com.google.android.gms.location.places.NearbyAlertRequest;
-import com.google.android.gms.location.places.PlaceFilter;
-import com.google.android.gms.location.places.PlaceReport;
-import com.google.android.gms.location.places.PlaceRequest;
-import com.google.android.gms.location.places.UserAddedPlace;
-import com.google.android.gms.location.places.UserDataType;
-import com.google.android.gms.location.places.internal.IPlacesCallbacks;
-import com.google.android.gms.location.places.internal.PlacesParams;
-import com.google.android.gms.maps.model.LatLng;
-import com.google.android.gms.maps.model.LatLngBounds;
-
-import org.microg.gms.common.PackageUtils;
-
-import java.util.Arrays;
-import java.util.List;
-
-public class GoogleLocationManagerServiceImpl extends IGoogleLocationManagerService.Stub {
- private static final String TAG = "GmsLocManagerSvcImpl";
-
- private final Context context;
- private GoogleLocationManager locationManager;
-
- public GoogleLocationManagerServiceImpl(Context context) {
- this.context = context;
- }
-
- private GoogleLocationManager getLocationManager() {
- if (locationManager == null)
- locationManager = new GoogleLocationManager(context);
- return locationManager;
- }
-
- @Override
- public void addGeofencesList(List geofences, PendingIntent pendingIntent,
- IGeofencerCallbacks callbacks, String packageName) throws RemoteException {
- Log.d(TAG, "addGeofencesList: " + geofences);
- PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid());
- }
-
- @Override
- public void removeGeofencesByIntent(PendingIntent pendingIntent, IGeofencerCallbacks callbacks,
- String packageName) throws RemoteException {
- Log.d(TAG, "removeGeofencesByIntent: " + pendingIntent);
- PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid());
- }
-
- @Override
- public void removeGeofencesById(String[] geofenceRequestIds, IGeofencerCallbacks callbacks,
- String packageName) throws RemoteException {
- Log.d(TAG, "removeGeofencesById: " + Arrays.toString(geofenceRequestIds));
- PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid());
- }
-
- @Override
- public void removeAllGeofences(IGeofencerCallbacks callbacks, String packageName) throws RemoteException {
- Log.d(TAG, "removeAllGeofences");
- PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid());
- }
-
- @Override
- public void requestActivityUpdates(long detectionIntervalMillis, boolean alwaysTrue,
- PendingIntent callbackIntent) throws RemoteException {
- Log.d(TAG, "requestActivityUpdates: " + callbackIntent);
- }
-
- @Override
- public void removeActivityUpdates(PendingIntent callbackIntent) throws RemoteException {
- Log.d(TAG, "removeActivityUpdates: " + callbackIntent);
- }
-
- @Override
- public ActivityRecognitionResult getLastActivity(String packageName) throws RemoteException {
- Log.d(TAG, "getLastActivity");
- PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid());
- return null;
- }
-
- @Override
- public Status iglms65(PendingIntent pendingIntent) throws RemoteException {
- Log.d(TAG, "iglms65");
- return null;
- }
-
- @Override
- public Status iglms66(PendingIntent pendingIntent) throws RemoteException {
- Log.d(TAG, "iglms66");
- return null;
- }
-
- @Override
- public Status requestGestureUpdates(GestureRequest request, PendingIntent pendingIntent) throws RemoteException {
- Log.d(TAG, "requestGestureUpdates");
- return null;
- }
-
- @Override
- public Status iglms61(PendingIntent pendingIntent) throws RemoteException {
- Log.d(TAG, "iglms61");
- return null;
- }
-
- @Override
- public Location getLastLocation() throws RemoteException {
- Log.d(TAG, "getLastLocation");
- return getLocationManager().getLastLocation(PackageUtils.getCallingPackage(context));
- }
-
- @Override
- public void requestLocationUpdatesWithListener(LocationRequest request,
- final ILocationListener listener) throws RemoteException {
- Log.d(TAG, "requestLocationUpdatesWithListener: " + request);
- getLocationManager().requestLocationUpdates(request, listener, PackageUtils.getCallingPackage(context));
- }
-
- @Override
- public void requestLocationUpdatesWithIntent(LocationRequest request,
- PendingIntent callbackIntent) throws RemoteException {
- Log.d(TAG, "requestLocationUpdatesWithIntent: " + request);
- getLocationManager().requestLocationUpdates(request, callbackIntent, PackageUtils.packageFromPendingIntent(callbackIntent));
- }
-
- @Override
- public void removeLocationUpdatesWithListener(ILocationListener listener)
- throws RemoteException {
- Log.d(TAG, "removeLocationUpdatesWithListener: " + listener);
- getLocationManager().removeLocationUpdates(listener, PackageUtils.getCallingPackage(context));
- }
-
- @Override
- public void removeLocationUpdatesWithIntent(PendingIntent callbackIntent)
- throws RemoteException {
- Log.d(TAG, "removeLocationUpdatesWithIntent: " + callbackIntent);
- getLocationManager().removeLocationUpdates(callbackIntent, PackageUtils.packageFromPendingIntent(callbackIntent));
- }
-
- @Override
- public void updateLocationRequest(LocationRequestUpdateData locationRequestUpdateData) throws RemoteException {
- Log.d(TAG, "updateLocationRequest: " + locationRequestUpdateData);
- getLocationManager().updateLocationRequest(locationRequestUpdateData);
- }
-
- @Override
- public void setMockMode(boolean mockMode) throws RemoteException {
- Log.d(TAG, "setMockMode: " + mockMode);
- getLocationManager().setMockMode(mockMode);
- }
-
- @Override
- public void setMockLocation(Location mockLocation) throws RemoteException {
- Log.d(TAG, "setMockLocation: " + mockLocation);
- getLocationManager().setMockLocation(mockLocation);
- }
-
- @Override
- public void iglms14(LatLngBounds var1, int var2, PlaceFilter var3, PlacesParams var4,
- IPlacesCallbacks var5) throws RemoteException {
- Log.d(TAG, "iglms14: " + var1);
- }
-
- @Override
- public void iglms15(String var1, PlacesParams var2, IPlacesCallbacks var3)
- throws RemoteException {
- Log.d(TAG, "iglms15: " + var1);
- }
-
- @Override
- public void iglms16(LatLng var1, PlaceFilter var2, PlacesParams var3, IPlacesCallbacks var4)
- throws RemoteException {
- Log.d(TAG, "iglms16: " + var1);
- }
-
- @Override
- public void iglms17(PlaceFilter var1, PlacesParams var2, IPlacesCallbacks var3)
- throws RemoteException {
- Log.d(TAG, "iglms17: " + var1);
- }
-
- @Override
- public void iglms18(PlaceRequest var1, PlacesParams var2, PendingIntent var3)
- throws RemoteException {
- Log.d(TAG, "iglms18: " + var1);
- }
-
- @Override
- public void iglms19(PlacesParams var1, PendingIntent var2) throws RemoteException {
- Log.d(TAG, "iglms19: " + var1);
- }
-
- @Override
- public void requestLocationUpdatesWithPackage(LocationRequest request, ILocationListener listener,
- String packageName) throws RemoteException {
- Log.d(TAG, "requestLocationUpdatesWithPackage: " + request);
- PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid());
- getLocationManager().requestLocationUpdates(request, listener, packageName);
- }
-
- @Override
- public Location getLastLocationWithPackage(String packageName) throws RemoteException {
- Log.d(TAG, "getLastLocationWithPackage: " + packageName);
- PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid());
- return getLocationManager().getLastLocation(packageName);
- }
-
- @Override
- public void iglms25(PlaceReport var1, PlacesParams var2) throws RemoteException {
- Log.d(TAG, "iglms25: " + var1);
- }
-
- @Override
- public void iglms26(Location var1, int var2) throws RemoteException {
- Log.d(TAG, "iglms26: " + var1);
- }
-
- @Override
- public LocationAvailability getLocationAvailabilityWithPackage(String packageName) throws RemoteException {
- Log.d(TAG, "getLocationAvailabilityWithPackage: " + packageName);
- PackageUtils.checkPackageUid(context, packageName, Binder.getCallingUid());
- return new LocationAvailability();
- }
-
- @Override
- public void iglms42(String var1, PlacesParams var2, IPlacesCallbacks var3)
- throws RemoteException {
- Log.d(TAG, "iglms42: " + var1);
- }
-
- @Override
- public void iglms46(UserAddedPlace var1, PlacesParams var2, IPlacesCallbacks var3)
- throws RemoteException {
- Log.d(TAG, "iglms46: " + var1);
- }
-
- @Override
- public void iglms47(LatLngBounds var1, int var2, String var3, PlaceFilter var4,
- PlacesParams var5, IPlacesCallbacks var6) throws RemoteException {
- Log.d(TAG, "iglms47: " + var1);
- }
-
- @Override
- public void iglms48(NearbyAlertRequest var1, PlacesParams var2, PendingIntent var3)
- throws RemoteException {
- Log.d(TAG, "iglms48: " + var1);
- }
-
- @Override
- public void iglms49(PlacesParams var1, PendingIntent var2) throws RemoteException {
- Log.d(TAG, "iglms49: " + var1);
- }
-
- @Override
- public void iglms50(UserDataType var1, LatLngBounds var2, List var3, PlacesParams var4,
- IPlacesCallbacks var5) throws RemoteException {
- Log.d(TAG, "iglms50: " + var1);
- }
-
- @Override
- public IBinder iglms51() throws RemoteException {
- Log.d(TAG, "iglms51");
- return null;
- }
-
- @Override
- public void requestLocationSettingsDialog(LocationSettingsRequest settingsRequest, ISettingsCallbacks callback, String packageName) throws RemoteException {
- Log.d(TAG, "requestLocationSettingsDialog: " + settingsRequest);
- PackageUtils.getAndCheckCallingPackage(context, packageName);
- callback.onLocationSettingsResult(new LocationSettingsResult(new LocationSettingsStates(true, true, false, true, true, false), Status.SUCCESS));
- }
-
- @Override
- public void requestLocationUpdatesInternalWithListener(LocationRequestInternal request,
- ILocationListener listener) throws RemoteException {
- Log.d(TAG, "requestLocationUpdatesInternalWithListener: " + request);
- getLocationManager().requestLocationUpdates(request.request, listener, PackageUtils.getCallingPackage(context));
- }
-
- @Override
- public void requestLocationUpdatesInternalWithIntent(LocationRequestInternal request,
- PendingIntent callbackIntent) throws RemoteException {
- Log.d(TAG, "requestLocationUpdatesInternalWithIntent: " + request);
- getLocationManager().requestLocationUpdates(request.request, callbackIntent, PackageUtils.packageFromPendingIntent(callbackIntent));
- }
-
- @Override
- public IBinder iglms54() throws RemoteException {
- Log.d(TAG, "iglms54");
- return null;
- }
-
- @Override
- public void iglms55(String var1, LatLngBounds var2, AutocompleteFilter var3, PlacesParams var4,
- IPlacesCallbacks var5) throws RemoteException {
- Log.d(TAG, "iglms55: " + var1);
- }
-
- @Override
- public void addGeofences(GeofencingRequest geofencingRequest, PendingIntent pendingIntent,
- IGeofencerCallbacks callbacks) throws RemoteException {
- Log.d(TAG, "addGeofences: " + geofencingRequest);
- }
-
- @Override
- public void iglms58(List var1, PlacesParams var2, IPlacesCallbacks var3)
- throws RemoteException {
- Log.d(TAG, "iglms58: " + var1);
- }
-
- @Override
- public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
- if (super.onTransact(code, data, reply, flags)) return true;
- Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags);
- return false;
- }
-}
diff --git a/play-services-location-core/src/main/java/org/microg/gms/location/LocationChangeListener.java b/play-services-location-core/src/main/java/org/microg/gms/location/LocationChangeListener.java
deleted file mode 100644
index f574746d..00000000
--- a/play-services-location-core/src/main/java/org/microg/gms/location/LocationChangeListener.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.location;
-
-public interface LocationChangeListener {
- public void onLocationChanged();
-}
diff --git a/play-services-location-core/src/main/java/org/microg/gms/location/LocationRequestHelper.java b/play-services-location-core/src/main/java/org/microg/gms/location/LocationRequestHelper.java
deleted file mode 100644
index ad67ae31..00000000
--- a/play-services-location-core/src/main/java/org/microg/gms/location/LocationRequestHelper.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.location;
-
-import android.annotation.TargetApi;
-import android.app.ActivityManager;
-import android.app.AppOpsManager;
-import android.app.PendingIntent;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.location.Location;
-import android.os.Binder;
-import android.os.Build;
-import android.os.RemoteException;
-import android.util.Log;
-
-import com.google.android.gms.location.ILocationCallback;
-import com.google.android.gms.location.ILocationListener;
-import com.google.android.gms.location.LocationRequest;
-import com.google.android.gms.location.LocationResult;
-import com.google.android.gms.location.internal.LocationRequestUpdateData;
-
-import org.microg.gms.common.PackageUtils;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static android.Manifest.permission.ACCESS_BACKGROUND_LOCATION;
-import static android.Manifest.permission.ACCESS_COARSE_LOCATION;
-import static android.Manifest.permission.ACCESS_FINE_LOCATION;
-
-public class LocationRequestHelper {
- public static final String TAG = "GmsLocRequestHelper";
- private final Context context;
- public final LocationRequest locationRequest;
- public final boolean initialHasFinePermission;
- public final boolean initialHasCoarsePermission;
- public final String packageName;
- public final int uid;
- private final boolean selfHasAppOpsRights;
- public ILocationListener listener;
- public PendingIntent pendingIntent;
- public ILocationCallback callback;
-
- private Location lastReport;
- private int numReports = 0;
-
- private LocationRequestHelper(Context context, LocationRequest locationRequest, String packageName, int uid) {
- this.context = context;
- this.locationRequest = locationRequest;
- this.packageName = packageName;
- this.uid = uid;
-
- this.initialHasFinePermission = context.getPackageManager().checkPermission(ACCESS_FINE_LOCATION, packageName) == PackageManager.PERMISSION_GRANTED;
- this.initialHasCoarsePermission = context.getPackageManager().checkPermission(ACCESS_COARSE_LOCATION, packageName) == PackageManager.PERMISSION_GRANTED;
-
- this.selfHasAppOpsRights = context.getPackageManager().checkPermission("android.permission.UPDATE_APP_OPS_STATS", context.getPackageName()) == PackageManager.PERMISSION_GRANTED;
- }
-
- public LocationRequestHelper(Context context, LocationRequest locationRequest, String packageName, int uid, ILocationListener listener) {
- this(context, locationRequest, packageName, uid);
- this.listener = listener;
- }
-
- public LocationRequestHelper(Context context, LocationRequest locationRequest, String packageName, int uid, PendingIntent pendingIntent) {
- this(context, locationRequest, packageName, uid);
- this.pendingIntent = pendingIntent;
- }
-
- public LocationRequestHelper(Context context, String packageName, int uid, LocationRequestUpdateData data) {
- this(context, data.request.request, packageName, uid);
- this.listener = data.listener;
- this.pendingIntent = data.pendingIntent;
- this.callback = data.callback;
- }
-
- /**
- * @return whether to continue sending reports to this {@link LocationRequestHelper}
- */
- public boolean report(Location location) {
- if (location == null) return true;
- if (!hasCoarsePermission()) return false;
- if (lastReport != null) {
- if (location.getTime() - lastReport.getTime() < locationRequest.getFastestInterval()) {
- return true;
- }
- if (location.distanceTo(lastReport) < locationRequest.getSmallestDesplacement()) {
- return true;
- }
- }
- lastReport = new Location(location);
- lastReport.setProvider("fused");
- Log.d(TAG, "sending Location: " + location + " to " + packageName);
- if (listener != null) {
- try {
- listener.onLocationChanged(lastReport);
- } catch (RemoteException e) {
- return false;
- }
- } else if (pendingIntent != null) {
- Intent intent = new Intent();
- intent.putExtra("com.google.android.location.LOCATION", lastReport);
- try {
- pendingIntent.send(context, 0, intent);
- } catch (PendingIntent.CanceledException e) {
- return false;
- }
- } else if (callback != null) {
- try {
- callback.onLocationResult(LocationResult.create(Arrays.asList(lastReport)));
- } catch (RemoteException e) {
- return false;
- }
- }
- numReports++;
- return numReports < locationRequest.getNumUpdates();
- }
-
- @Override
- public String toString() {
- return "LocationRequestHelper{" +
- "locationRequest=" + locationRequest +
- ", hasFinePermission=" + hasFinePermission() +
- ", hasCoarsePermission=" + hasCoarsePermission() +
- ", packageName='" + packageName + '\'' +
- ", lastReport=" + lastReport +
- '}';
- }
-
- public boolean respondsTo(ILocationListener listener) {
- return this.listener != null && listener != null &&
- this.listener.asBinder().equals(listener.asBinder());
- }
-
- public boolean respondsTo(ILocationCallback callback) {
- return this.callback != null && callback != null &&
- this.callback.asBinder().equals(callback.asBinder());
- }
-
- public boolean respondsTo(PendingIntent pendingIntent) {
- return this.pendingIntent != null && this.pendingIntent.equals(pendingIntent);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- LocationRequestHelper that = (LocationRequestHelper) o;
-
- if (!locationRequest.equals(that.locationRequest)) return false;
- if (packageName != null ? !packageName.equals(that.packageName) : that.packageName != null) return false;
- if (listener != null ? !listener.equals(that.listener) : that.listener != null) return false;
- if (pendingIntent != null ? !pendingIntent.equals(that.pendingIntent) : that.pendingIntent != null)
- return false;
- return !(callback != null ? !callback.equals(that.callback) : that.callback != null);
- }
-
- public boolean hasFinePermission() {
- if (Build.VERSION.SDK_INT >= 19) {
- return isAppOpsAllowed(AppOpsManager.OPSTR_FINE_LOCATION, initialHasFinePermission);
- } else {
- return initialHasFinePermission;
- }
- }
-
- public boolean hasCoarsePermission() {
- if (Build.VERSION.SDK_INT >= 19) {
- return isAppOpsAllowed(AppOpsManager.OPSTR_COARSE_LOCATION, initialHasCoarsePermission);
- } else {
- return initialHasCoarsePermission;
- }
- }
-
- @TargetApi(19)
- private boolean isAppOpsAllowed(String op, boolean def) {
- AppOpsManager appOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
- if (appOpsManager == null) return def;
- try {
- if (Binder.getCallingUid() == uid && Build.VERSION.SDK_INT >= 23) {
- return appOpsManager.noteProxyOpNoThrow(op, packageName) == AppOpsManager.MODE_ALLOWED;
- } else if (Build.VERSION.SDK_INT >= 29) {
- return appOpsManager.noteProxyOpNoThrow(op, packageName, uid) == AppOpsManager.MODE_ALLOWED;
- } else if (selfHasAppOpsRights) {
- return appOpsManager.noteOpNoThrow(op, uid, packageName) == AppOpsManager.MODE_ALLOWED;
- } else {
- // TODO: More variant that works pre-29 and without perms?
- Log.w(TAG, "Can't check appops (yet)");
- return def;
- }
- } catch (Exception e) {
- Log.w(TAG, e);
- return def;
- }
- }
-
- @Override
- public int hashCode() {
- int result = locationRequest.hashCode();
- result = 31 * result + (packageName != null ? packageName.hashCode() : 0);
- result = 31 * result + (listener != null ? listener.hashCode() : 0);
- result = 31 * result + (pendingIntent != null ? pendingIntent.hashCode() : 0);
- result = 31 * result + (callback != null ? callback.hashCode() : 0);
- return result;
- }
-}
diff --git a/play-services-location-core/src/main/java/org/microg/gms/location/MockLocationProvider.java b/play-services-location-core/src/main/java/org/microg/gms/location/MockLocationProvider.java
deleted file mode 100644
index bdeb7318..00000000
--- a/play-services-location-core/src/main/java/org/microg/gms/location/MockLocationProvider.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.location;
-
-import android.location.Location;
-import android.os.Bundle;
-
-import static org.microg.gms.location.LocationConstants.KEY_MOCK_LOCATION;
-
-public class MockLocationProvider {
- private boolean mockEnabled = false;
- private Location mockLocation = null;
- private final LocationChangeListener changeListener;
-
- public MockLocationProvider(LocationChangeListener changeListener) {
- this.changeListener = changeListener;
- }
-
- public void setMockEnabled(boolean mockEnabled) {
- this.mockEnabled = mockEnabled;
- }
-
- public Location getLocation() {
- return mockEnabled ? mockLocation : null;
- }
-
- public void setLocation(Location mockLocation) {
- if (mockLocation.getExtras() == null) {
- mockLocation.setExtras(new Bundle());
- }
- mockLocation.getExtras().putBoolean(KEY_MOCK_LOCATION, false);
- this.mockLocation = mockLocation;
- this.changeListener.onLocationChanged();
- }
-}
diff --git a/play-services-location-core/src/main/java/org/microg/gms/location/RealLocationProvider.java b/play-services-location-core/src/main/java/org/microg/gms/location/RealLocationProvider.java
deleted file mode 100644
index 0ae75148..00000000
--- a/play-services-location-core/src/main/java/org/microg/gms/location/RealLocationProvider.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.location;
-
-import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
-import android.os.Bundle;
-import android.os.Looper;
-import android.util.Log;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-@SuppressWarnings("MissingPermission")
-public class RealLocationProvider {
- public static final String TAG = "GmsLocProviderReal";
-
- private final LocationManager locationManager;
- private final String name;
- private final AtomicBoolean connected = new AtomicBoolean(false);
- private final LocationChangeListener changeListener;
-
- private long connectedMinTime;
- private float connectedMinDistance;
- private Location lastLocation;
- private final List requests = new ArrayList();
- private LocationListener listener = new LocationListener() {
- @Override
- public void onLocationChanged(Location location) {
- lastLocation = location;
- changeListener.onLocationChanged();
- }
-
- @Override
- public void onStatusChanged(String s, int i, Bundle bundle) {
-
- }
-
- @Override
- public void onProviderEnabled(String s) {
-
- }
-
- @Override
- public void onProviderDisabled(String s) {
-
- }
- };
-
- public RealLocationProvider(LocationManager locationManager, String name, LocationChangeListener changeListener) {
- this.locationManager = locationManager;
- this.name = name;
- this.changeListener = changeListener;
- updateLastLocation();
- }
-
- private void updateLastLocation() {
- Location newLocation = locationManager.getLastKnownLocation(name);
- if (newLocation != null) lastLocation = newLocation;
- }
-
- public Location getLastLocation() {
- if (!connected.get()) {
- updateLastLocation();
- }
- if (lastLocation == null) {
- Log.d(TAG, "uh-ok: last location for " + name + " is null!");
- }
- return lastLocation;
- }
-
- public void addRequest(LocationRequestHelper request) {
- Log.d(TAG, name + ": addRequest " + request);
- for (int i = 0; i < requests.size(); i++) {
- LocationRequestHelper req = requests.get(i);
- if (req.respondsTo(request.pendingIntent) || req.respondsTo(request.listener) || req.respondsTo(request.callback)) {
- requests.remove(i);
- i--;
- }
- }
- requests.add(request);
- updateConnection();
- }
-
- public void removeRequest(LocationRequestHelper request) {
- Log.d(TAG, name + ": removeRequest " + request);
- requests.remove(request);
- updateConnection();
- }
-
- private synchronized void updateConnection() {
- if (connected.get() && requests.isEmpty()) {
- Log.d(TAG, name + ": no longer requesting location update");
- locationManager.removeUpdates(listener);
- connected.set(false);
- } else if (!requests.isEmpty()) {
- long minTime = Long.MAX_VALUE;
- float minDistance = Float.MAX_VALUE;
- StringBuilder sb = new StringBuilder();
- for (LocationRequestHelper request : requests) {
- minTime = Math.min(request.locationRequest.getInterval(), minTime);
- minDistance = Math.min(request.locationRequest.getSmallestDesplacement(), minDistance);
- if (sb.length() != 0) sb.append(", ");
- sb.append(request.packageName).append(":").append(request.locationRequest.getInterval()).append("ms");
- }
- Log.d(TAG, name + ": requesting location updates with interval " + minTime + "ms (" + sb + "), minDistance=" + minDistance);
- if (connected.get()) {
- if (connectedMinTime != minTime || connectedMinDistance != minDistance) {
- locationManager.removeUpdates(listener);
- locationManager.requestLocationUpdates(name, minTime, minDistance, listener,
- Looper.getMainLooper());
- }
- } else {
- locationManager.requestLocationUpdates(name, minTime, minDistance, listener, Looper.getMainLooper());
- }
- connected.set(true);
- connectedMinTime = minTime;
- connectedMinDistance = minDistance;
- }
- }
-}
diff --git a/play-services-location-core/src/main/java/org/microg/gms/location/ReportingAndroidService.java b/play-services-location-core/src/main/java/org/microg/gms/location/ReportingAndroidService.java
deleted file mode 100644
index d382cdcc..00000000
--- a/play-services-location-core/src/main/java/org/microg/gms/location/ReportingAndroidService.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.location;
-
-import android.os.RemoteException;
-
-import com.google.android.gms.common.internal.GetServiceRequest;
-import com.google.android.gms.common.internal.IGmsCallbacks;
-
-import org.microg.gms.BaseService;
-import org.microg.gms.common.GmsService;
-
-public class ReportingAndroidService extends BaseService {
- private ReportingServiceImpl reportingService = new ReportingServiceImpl();
-
- public ReportingAndroidService() {
- super("GmsLocReportingSvc", GmsService.LOCATION_REPORTING);
- }
-
- @Override
- public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException {
- callback.onPostInitComplete(0, reportingService.asBinder(), null);
- }
-}
diff --git a/play-services-location-core/src/main/java/org/microg/gms/location/ReportingServiceImpl.java b/play-services-location-core/src/main/java/org/microg/gms/location/ReportingServiceImpl.java
deleted file mode 100644
index c091cbde..00000000
--- a/play-services-location-core/src/main/java/org/microg/gms/location/ReportingServiceImpl.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.location;
-
-import android.accounts.Account;
-import android.os.RemoteException;
-import android.util.Log;
-
-import com.google.android.gms.location.places.PlaceReport;
-import com.google.android.gms.location.reporting.ReportingState;
-import com.google.android.gms.location.reporting.UploadRequest;
-import com.google.android.gms.location.reporting.UploadRequestResult;
-import com.google.android.gms.location.reporting.internal.IReportingService;
-
-public class ReportingServiceImpl extends IReportingService.Stub {
- private static final String TAG = "GmsLocReportSvcImpl";
-
- @Override
- public ReportingState getReportingState(Account account) throws RemoteException {
- Log.d(TAG, "getReportingState");
- return new ReportingState();
- }
-
- @Override
- public int tryOptIn(Account account) throws RemoteException {
- Log.d(TAG, "tryOptIn");
- return 0;
- }
-
- @Override
- public UploadRequestResult requestUpload(UploadRequest request) throws RemoteException {
- Log.d(TAG, "requestUpload");
- return new UploadRequestResult();
- }
-
- @Override
- public int cancelUploadRequest(long l) throws RemoteException {
- Log.d(TAG, "cancelUploadRequest");
- return 0;
- }
-
- @Override
- public int reportDeviceAtPlace(Account account, PlaceReport report) throws RemoteException {
- Log.d(TAG, "reportDeviceAtPlace");
- return 0;
- }
-}
diff --git a/play-services-location-core/src/main/java/org/microg/gms/location/UnifiedLocationProvider.kt b/play-services-location-core/src/main/java/org/microg/gms/location/UnifiedLocationProvider.kt
deleted file mode 100644
index 51cbfbf5..00000000
--- a/play-services-location-core/src/main/java/org/microg/gms/location/UnifiedLocationProvider.kt
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.microg.gms.location
-
-import android.content.Context
-import android.location.Location
-import android.util.Log
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.launch
-import org.microg.nlp.client.UnifiedLocationClient
-import java.util.*
-import java.util.concurrent.atomic.AtomicBoolean
-
-class UnifiedLocationProvider(context: Context?, changeListener: LocationChangeListener) {
- private val client: UnifiedLocationClient
- private var connectedMinTime: Long = 0
- private var lastLocation: Location? = null
- private val connected = AtomicBoolean(false)
- private val changeListener: LocationChangeListener
- private val requests: MutableList = ArrayList()
- private val listener: UnifiedLocationClient.LocationListener = object : UnifiedLocationClient.LocationListener {
- override fun onLocation(location: Location) {
- lastLocation = location
- changeListener.onLocationChanged()
- }
- }
-
- private fun updateLastLocation() {
- GlobalScope.launch {
- client.getLastLocation()?.let { lastLocation = it }
- }
- }
-
- fun addRequest(request: LocationRequestHelper) {
- Log.d(TAG, "unified network: addRequest $request")
- for (i in 0..requests.size) {
- if (i >= requests.size) break
- val req = requests[i]
- if (req.respondsTo(request.pendingIntent) || req.respondsTo(request.listener) || req.respondsTo(request.callback)) {
- requests.removeAt(i)
- }
- }
- requests.add(request)
- updateConnection()
- }
-
- fun removeRequest(request: LocationRequestHelper) {
- Log.d(TAG, "unified network: removeRequest $request")
- requests.remove(request)
- updateConnection()
- }
-
- fun getLastLocation(): Location? {
- if (lastLocation == null) {
- Log.d(TAG, "uh-ok: last location for unified network is null!")
- }
- return lastLocation
- }
-
- @Synchronized
- private fun updateConnection() {
- if (connected.get() && requests.isEmpty()) {
- Log.d(TAG, "unified network: no longer requesting location update")
- client.removeLocationUpdates(listener)
- connected.set(false)
- } else if (!requests.isEmpty()) {
- var minTime = Long.MAX_VALUE
- val sb = StringBuilder()
- var opPackageName: String? = null
- for (request in requests) {
- if (request.locationRequest.interval < minTime) {
- opPackageName = request.packageName
- minTime = request.locationRequest.interval
- }
- if (sb.isNotEmpty()) sb.append(", ")
- sb.append("${request.packageName}:${request.locationRequest.interval}ms")
- }
- client.opPackageName = opPackageName
- Log.d(TAG, "unified network: requesting location updates with interval ${minTime}ms ($sb)")
- if (!connected.get() || connectedMinTime != minTime) {
- client.requestLocationUpdates(listener, minTime)
- }
- connected.set(true)
- connectedMinTime = minTime
- }
- }
-
- companion object {
- const val TAG = "GmsLocProviderU"
- }
-
- init {
- client = UnifiedLocationClient[context!!]
- this.changeListener = changeListener
- updateLastLocation()
- }
-}
\ No newline at end of file
diff --git a/play-services-location/build.gradle b/play-services-location/build.gradle
deleted file mode 100644
index a19126df..00000000
--- a/play-services-location/build.gradle
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2013-2015 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-apply plugin: 'com.android.library'
-
-String getMyVersionName() {
- def stdout = new ByteArrayOutputStream()
- if (rootProject.file("gradlew").exists())
- exec { commandLine 'git', 'describe', '--tags', '--always', '--dirty'; standardOutput = stdout }
- else // automatic build system, don't tag dirty
- exec { commandLine 'git', 'describe', '--tags', '--always'; standardOutput = stdout }
- return stdout.toString().trim().substring(1)
-}
-
-android {
- compileSdkVersion androidCompileSdk()
- buildToolsVersion "$androidBuildVersionTools"
-
- defaultConfig {
- versionName getMyVersionName()
- minSdkVersion androidMinSdk()
- targetSdkVersion androidTargetSdk()
- }
-
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
-}
-
-dependencies {
- api project(':play-services-base')
- api project(':play-services-location-api')
-}
\ No newline at end of file
diff --git a/play-services-location/gradle.properties b/play-services-location/gradle.properties
deleted file mode 100644
index bfc9b4b2..00000000
--- a/play-services-location/gradle.properties
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# Copyright 2013-2016 microG Project Team
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-POM_NAME=Play Services Cast Library
-POM_DESCRIPTION=The Play Services Library module to access Google Location Services
-
-POM_PACKAGING=aar
-
-POM_URL=https://github.com/microg/android_external_GmsLib
-
-POM_SCM_URL=https://github.com/microg/android_external_GmsLib
-POM_SCM_CONNECTION=scm:git@github.com:microg/android_external_GmsLib.git
-POM_SCM_DEV_CONNECTION=scm:git@github.com:microg/android_external_GmsLib.git
-
-POM_LICENCE_NAME=The Apache Software License, Version 2.0
-POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
-POM_LICENCE_DIST=repo
-
-POM_DEVELOPER_ID=mar-v-in
-POM_DEVELOPER_NAME=Marvin W
-
diff --git a/play-services-location/src/main/AndroidManifest.xml b/play-services-location/src/main/AndroidManifest.xml
deleted file mode 100644
index 79e10fc2..00000000
--- a/play-services-location/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/play-services-location/src/main/java/com/google/android/gms/location/ActivityRecognition.java b/play-services-location/src/main/java/com/google/android/gms/location/ActivityRecognition.java
deleted file mode 100644
index ef9d76c3..00000000
--- a/play-services-location/src/main/java/com/google/android/gms/location/ActivityRecognition.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import com.google.android.gms.common.api.Api;
-import com.google.android.gms.common.api.GoogleApiClient.Builder;
-
-import org.microg.gms.location.ActivityRecognitionApiBuilder;
-import org.microg.gms.location.ActivityRecognitionApiImpl;
-
-/**
- * The main entry point for activity recognition integration.
- */
-public class ActivityRecognition {
- public static final String CLIENT_NAME = "activity_recognition";
-
- /**
- * Token to pass to {@link Builder#addApi(Api)} to enable ContextServices.
- */
- public static final Api API = new Api(new ActivityRecognitionApiBuilder());
-
- /**
- * Entry point to the activity recognition APIs.
- */
- public static final ActivityRecognitionApi ActivityRecognitionApi = new ActivityRecognitionApiImpl();
-}
diff --git a/play-services-location/src/main/java/com/google/android/gms/location/ActivityRecognitionApi.java b/play-services-location/src/main/java/com/google/android/gms/location/ActivityRecognitionApi.java
deleted file mode 100644
index 08bc50b9..00000000
--- a/play-services-location/src/main/java/com/google/android/gms/location/ActivityRecognitionApi.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (C) 2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import android.app.PendingIntent;
-import android.os.Bundle;
-
-import com.google.android.gms.common.api.GoogleApiClient;
-import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
-import com.google.android.gms.common.api.PendingResult;
-import com.google.android.gms.common.api.Status;
-
-/**
- * The main entry point for interacting with activity recognition.
- *
- * The methods must be used in conjunction with a GoogleApiClient. E.g.
- *
- * new GoogleApiClient.Builder(context)
- * .addApi(ActivityRecognition.API)
- * .addConnectionCallbacks(this)
- * .addOnConnectionFailedListener(this)
- * .build()
- *
- */
-public interface ActivityRecognitionApi {
- /**
- * Removes all activity updates for the specified PendingIntent.
- *
- * Calling this function requires the com.google.android.gms.permission.ACTIVITY_RECOGNITION
- * permission.
- *
- * @param client An existing GoogleApiClient. It must be connected at the time of this
- * call, which is normally achieved by calling {@link GoogleApiClient#connect()}
- * and waiting for {@link ConnectionCallbacks#onConnected(Bundle)} to be
- * called.
- * @param callbackIntent the PendingIntent that was used in {@code #requestActivityUpdates(GoogleApiClient, long, PendingIntent)}
- * or is equal as defined by {@link Object#equals(Object)}.
- * @return a PendingResult for the call, check {@link Status#isSuccess()} to determine if it
- * was successful.
- */
- PendingResult removeActivityUpdates(GoogleApiClient client, PendingIntent callbackIntent);
-
- /**
- * Register for activity recognition updates.
- *
- * The activities are detected by periodically waking up the device and reading short bursts of
- * sensor data. It only makes use of low power sensors in order to keep the power usage to a
- * minimum. For example, it can detect if the user is currently on foot, in a car, on a bicycle
- * or still. See {@link DetectedActivity} for more details.
- *
- * The activity detection update interval can be controlled with the detectionIntervalMillis
- * parameter. Larger values will result in fewer activity detections while improving battery
- * life. Smaller values will result in more frequent activity detections but will consume more
- * power since the device must be woken up more frequently. {@code Long.MAX_VALUE} means it only
- * monitors the results requested by other clients without consuming additional power.
- *
- * Activities may be received more frequently than the detectionIntervalMillis parameter if
- * another application has also requested activity updates at a faster rate. It may also receive
- * updates faster when the activity detection service receives a signal that the current
- * activity may change, such as if the device has been still for a long period of time and is
- * then unplugged from a phone charger.
- *
- * Activities may arrive several seconds after the requested detectionIntervalMillis if the
- * activity detection service requires more samples to make a more accurate prediction.
- *
- * To conserve battery, activity reporting may stop when the device is 'STILL' for an extended
- * period of time. It will resume once the device moves again. This only happens on devices that
- * support the Sensor.TYPE_SIGNIFICANT_MOTION hardware.
- *
- * Beginning in API 21, activities may be received less frequently than the
- * detectionIntervalMillis parameter if the device is in power save mode and the screen is off.
- *
- * A common use case is that an application wants to monitor activities in the background and
- * perform an action when a specific activity is detected. To do this without needing a service
- * that is always on in the background consuming resources, detected activities are delivered
- * via an intent. The application specifies a PendingIntent callback (typically an
- * IntentService) which will be called with an intent when activities are detected. The intent
- * recipient can extract the {@link ActivityRecognitionResult} using {@link ActivityRecognitionResult#extractResult(android.content.Intent)}.
- * See the documentation of {@link PendingIntent} for more details.
- *
- * Any requests previously registered with {@link #requestActivityUpdates(GoogleApiClient, long, PendingIntent)}
- * that have the same PendingIntent (as defined by {@link Object#equals(Object)}) will be
- * replaced by this request.
- *
- * Calling this function requires the com.google.android.gms.permission.ACTIVITY_RECOGNITION
- * permission.
- *
- * @param client An existing GoogleApiClient. It must be connected at the time
- * of this call, which is normally achieved by calling {@link GoogleApiClient#connect()}
- * and waiting for {@link ConnectionCallbacks#onConnected(Bundle)}
- * to be called.
- * @param detectionIntervalMillis the desired time between activity detections. Larger values
- * will result in fewer activity detections while improving
- * battery life. A value of 0 will result in activity detections
- * at the fastest possible rate.
- * @param callbackIntent a PendingIntent to be sent for each activity detection.
- * @return a PendingResult for the call, check {@link Status#isSuccess()} to determine if it
- * was successful.
- */
- PendingResult requestActivityUpdates(GoogleApiClient client, long detectionIntervalMillis, PendingIntent callbackIntent);
-}
diff --git a/play-services-location/src/main/java/com/google/android/gms/location/FusedLocationProviderApi.java b/play-services-location/src/main/java/com/google/android/gms/location/FusedLocationProviderApi.java
deleted file mode 100644
index 768111b5..00000000
--- a/play-services-location/src/main/java/com/google/android/gms/location/FusedLocationProviderApi.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import android.app.PendingIntent;
-import android.location.Location;
-import android.os.Looper;
-
-import com.google.android.gms.common.api.GoogleApiClient;
-import com.google.android.gms.common.api.PendingResult;
-import com.google.android.gms.common.api.Status;
-
-import org.microg.gms.location.LocationConstants;
-
-public interface FusedLocationProviderApi {
- @Deprecated
- String KEY_LOCATION_CHANGED = "com.google.android.location.LOCATION";
- String KEY_MOCK_LOCATION = LocationConstants.KEY_MOCK_LOCATION;
-
- Location getLastLocation(GoogleApiClient client);
-
- PendingResult requestLocationUpdates(GoogleApiClient client, LocationRequest request,
- LocationListener listener);
-
- PendingResult requestLocationUpdates(GoogleApiClient client, LocationRequest request,
- LocationListener listener, Looper looper);
-
- PendingResult requestLocationUpdates(GoogleApiClient client, LocationRequest request,
- PendingIntent callbackIntent);
-
- PendingResult removeLocationUpdates(GoogleApiClient client, LocationListener listener);
-
- PendingResult removeLocationUpdates(GoogleApiClient client,
- PendingIntent callbackIntent);
-
- PendingResult setMockMode(GoogleApiClient client, boolean isMockMode);
-
- PendingResult setMockLocation(GoogleApiClient client, Location mockLocation);
-}
diff --git a/play-services-location/src/main/java/com/google/android/gms/location/GeofencingApi.java b/play-services-location/src/main/java/com/google/android/gms/location/GeofencingApi.java
deleted file mode 100644
index 784c5c3e..00000000
--- a/play-services-location/src/main/java/com/google/android/gms/location/GeofencingApi.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import android.app.PendingIntent;
-
-import com.google.android.gms.common.api.GoogleApiClient;
-import com.google.android.gms.common.api.PendingResult;
-import com.google.android.gms.common.api.Status;
-
-import java.util.List;
-
-/**
- * The main entry point for interacting with the geofencing APIs.
- *
- * The methods must be used in conjunction with a GoogleApiClient. E.g.
- *
- * new GoogleApiClient.Builder(context)
- * .addApi(LocationServices.API)
- * .addConnectionCallbacks(this)
- * .addOnConnectionFailedListener(this)
- * .build()
- *
- */
-public interface GeofencingApi {
- PendingResult addGeofences(GoogleApiClient client, GeofencingRequest geofencingRequest, PendingIntent pendingIntent);
-
- @Deprecated
- PendingResult addGeofences(GoogleApiClient client, List geofences, PendingIntent pendingIntent);
-
- PendingResult removeGeofences(GoogleApiClient client, List geofenceRequestIds);
-
- PendingResult removeGeofences(GoogleApiClient client, PendingIntent pendingIntent);
-}
diff --git a/play-services-location/src/main/java/com/google/android/gms/location/LocationClient.java b/play-services-location/src/main/java/com/google/android/gms/location/LocationClient.java
deleted file mode 100644
index 47ec9568..00000000
--- a/play-services-location/src/main/java/com/google/android/gms/location/LocationClient.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import android.app.PendingIntent;
-import android.content.Context;
-import android.location.Location;
-import android.os.Looper;
-
-import com.google.android.gms.common.api.GoogleApiClient;
-import com.google.android.gms.common.api.PendingResult;
-
-import org.microg.gms.common.ForwardConnectionCallbacks;
-import org.microg.gms.common.ForwardConnectionFailedListener;
-import org.microg.gms.common.api.AbstractPlayServicesClient;
-
-/**
- * This class is deprecated as of play services 6.5, do not use it in production systems,
- * it's just a forwarder for the {@link FusedLocationProviderApi}.
- */
-@Deprecated
-public class LocationClient extends AbstractPlayServicesClient {
- public static final String KEY_LOCATION_CHANGED = "com.google.android.location.LOCATION";
-
- public LocationClient(Context context, ConnectionCallbacks callbacks,
- OnConnectionFailedListener connectionFailedListener) {
- super(new GoogleApiClient.Builder(context)
- .addApi(LocationServices.API)
- .addConnectionCallbacks(new ForwardConnectionCallbacks(callbacks))
- .addOnConnectionFailedListener(new ForwardConnectionFailedListener
- (connectionFailedListener))
- .build());
- }
-
- public Location getLastLocation() {
- assertConnected();
- return LocationServices.FusedLocationApi.getLastLocation(googleApiClient);
- }
-
- public void requestLocationUpdates(LocationRequest request,
- LocationListener listener) {
- assertConnected();
- LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, request,
- listener).await();
- }
-
- public void requestLocationUpdates(LocationRequest request,
- LocationListener listener, Looper looper) {
- assertConnected();
- LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, request,
- listener, looper).await();
- }
-
- public void requestLocationUpdates(LocationRequest request,
- PendingIntent callbackIntent) {
- assertConnected();
- LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, request,
- callbackIntent).await();
- }
-
- public void removeLocationUpdates(LocationListener listener) {
- assertConnected();
- LocationServices.FusedLocationApi.removeLocationUpdates(googleApiClient, listener).await();
- }
-
- public void removeLocationUpdates(PendingIntent callbackIntent) {
- assertConnected();
- LocationServices.FusedLocationApi.removeLocationUpdates(googleApiClient,
- callbackIntent).await();
- }
-
- public void setMockMode(boolean isMockMode) {
- assertConnected();
- LocationServices.FusedLocationApi.setMockMode(googleApiClient, isMockMode).await();
- }
-
- public void setMockLocation(Location mockLocation) {
- assertConnected();
- LocationServices.FusedLocationApi.setMockLocation(googleApiClient, mockLocation).await();
- }
-}
diff --git a/play-services-location/src/main/java/com/google/android/gms/location/LocationListener.java b/play-services-location/src/main/java/com/google/android/gms/location/LocationListener.java
deleted file mode 100644
index 59c9585c..00000000
--- a/play-services-location/src/main/java/com/google/android/gms/location/LocationListener.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import android.location.Location;
-
-/**
- * Used for receiving notifications from the {@link FusedLocationProviderApi} when the location has
- * changed. The methods are called if the LocationListener has been registered with the location
- * client.
- */
-public interface LocationListener {
-
- /**
- * Called when the location has changed.
- *
- * @param location The updated location.
- */
- public void onLocationChanged(Location location);
-}
diff --git a/play-services-location/src/main/java/com/google/android/gms/location/LocationServices.java b/play-services-location/src/main/java/com/google/android/gms/location/LocationServices.java
deleted file mode 100644
index 839550f4..00000000
--- a/play-services-location/src/main/java/com/google/android/gms/location/LocationServices.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import com.google.android.gms.common.api.Api;
-import com.google.android.gms.common.api.GoogleApiClient.Builder;
-
-import org.microg.gms.location.FusedLocationProviderApiImpl;
-import org.microg.gms.location.GeofencingApiImpl;
-import org.microg.gms.location.LocationServicesApiBuilder;
-import org.microg.gms.location.SettingsApiImpl;
-
-/**
- * The main entry point for location services integration.
- */
-public class LocationServices {
- /**
- * Token to pass to {@link Builder#addApi(Api)} to enable LocationServices.
- */
- public static final Api API = new Api(new LocationServicesApiBuilder());
-
- /**
- * Entry point to the fused location APIs.
- */
- public static final FusedLocationProviderApi FusedLocationApi = new FusedLocationProviderApiImpl();
-
- /**
- * Entry point to the geofencing APIs.
- */
- public static final GeofencingApi GeofencingApi = new GeofencingApiImpl();
-
- /**
- * Entry point to the location settings-enabler dialog APIs.
- */
- public static final SettingsApi SettingsApi = new SettingsApiImpl();
-}
diff --git a/play-services-location/src/main/java/com/google/android/gms/location/LocationStatusCodes.java b/play-services-location/src/main/java/com/google/android/gms/location/LocationStatusCodes.java
deleted file mode 100644
index 4e3f7d54..00000000
--- a/play-services-location/src/main/java/com/google/android/gms/location/LocationStatusCodes.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-@Deprecated
-public class LocationStatusCodes {
- public static final int ERROR = 1;
- public static final int GEOFENCE_NOT_AVAILABLE = 1000;
- public static final int GEOFENCE_TOO_MANY_GEOFENCES = 1001;
- public static final int GEOFENCE_TOO_MANY_PENDING_INTENTS = 1002;
- public static final int SUCCESS = 0;
-}
diff --git a/play-services-location/src/main/java/com/google/android/gms/location/SettingsApi.java b/play-services-location/src/main/java/com/google/android/gms/location/SettingsApi.java
deleted file mode 100644
index 708d7d02..00000000
--- a/play-services-location/src/main/java/com/google/android/gms/location/SettingsApi.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.location;
-
-import com.google.android.gms.common.api.GoogleApiClient;
-import com.google.android.gms.common.api.PendingResult;
-
-/**
- * The main entry point for interacting with the location settings-enabler APIs.
- *
- * This API makes it easy for an app to ensure that the device's system settings are properly
- * configured for the app's location needs.
- */
-public interface SettingsApi {
- /**
- * Checks if the relevant system settings are enabled on the device to carry out the desired
- * location requests.
- *
- * @param client an existing GoogleApiClient. It does not need to be connected
- * at the time of this call, but the result will be delayed until
- * the connection is complete.
- * @param locationSettingsRequest an object that contains all the location requirements that the
- * client is interested in.
- * @return result containing the status of the request.
- */
- PendingResult checkLocationSettings(GoogleApiClient client, LocationSettingsRequest locationSettingsRequest);
-}
diff --git a/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionApiBuilder.java b/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionApiBuilder.java
deleted file mode 100644
index f36ed0c0..00000000
--- a/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionApiBuilder.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.location;
-
-import android.content.Context;
-import android.os.Looper;
-
-import com.google.android.gms.common.api.AccountInfo;
-import com.google.android.gms.common.api.Api;
-import com.google.android.gms.common.api.GoogleApiClient;
-
-import org.microg.gms.common.api.ApiBuilder;
-import org.microg.gms.common.api.ApiConnection;
-
-public class ActivityRecognitionApiBuilder implements ApiBuilder {
- @Override
- public ApiConnection build(Context context, Looper looper, Api.ApiOptions.NoOptions options, AccountInfo accountInfo, GoogleApiClient.ConnectionCallbacks callbacks, GoogleApiClient.OnConnectionFailedListener connectionFailedListener) {
- return new ActivityRecognitionClientImpl(context, callbacks, connectionFailedListener);
- }
-}
diff --git a/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionApiImpl.java b/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionApiImpl.java
deleted file mode 100644
index 5c09eefd..00000000
--- a/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionApiImpl.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.location;
-
-import android.app.PendingIntent;
-import android.os.RemoteException;
-import android.util.Log;
-
-import com.google.android.gms.common.api.GoogleApiClient;
-import com.google.android.gms.common.api.PendingResult;
-import com.google.android.gms.common.api.Status;
-import com.google.android.gms.location.ActivityRecognition;
-import com.google.android.gms.location.ActivityRecognitionApi;
-
-import org.microg.gms.common.GmsConnector;
-
-public class ActivityRecognitionApiImpl implements ActivityRecognitionApi {
- private static final String TAG = "GmsActivityApiImpl";
-
- @Override
- public PendingResult removeActivityUpdates(GoogleApiClient client, final PendingIntent callbackIntent) {
- return callVoid(client, new Runnable() {
- @Override
- public void run(ActivityRecognitionClientImpl client) throws RemoteException {
- client.removeActivityUpdates(callbackIntent);
- }
- });
- }
-
- @Override
- public PendingResult requestActivityUpdates(GoogleApiClient client, final long detectionIntervalMillis, final PendingIntent callbackIntent) {
- return callVoid(client, new Runnable() {
- @Override
- public void run(ActivityRecognitionClientImpl client) throws RemoteException {
- client.requestActivityUpdates(detectionIntervalMillis, callbackIntent);
- }
- });
- }
-
- private PendingResult callVoid(GoogleApiClient client, final Runnable runnable) {
- return GmsConnector.call(client, ActivityRecognition.API, new GmsConnector.Callback() {
- @Override
- public void onClientAvailable(ActivityRecognitionClientImpl client, ResultProvider resultProvider) throws RemoteException {
- runnable.run(client);
- resultProvider.onResultAvailable(Status.SUCCESS);
- }
- });
- }
-
- private interface Runnable {
- void run(ActivityRecognitionClientImpl client) throws RemoteException;
- }
-}
diff --git a/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionClientImpl.java b/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionClientImpl.java
deleted file mode 100644
index cf065fc9..00000000
--- a/play-services-location/src/main/java/org/microg/gms/location/ActivityRecognitionClientImpl.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.location;
-
-import android.app.PendingIntent;
-import android.content.Context;
-import android.os.RemoteException;
-
-import com.google.android.gms.common.api.GoogleApiClient;
-
-public class ActivityRecognitionClientImpl extends GoogleLocationManagerClient {
- public ActivityRecognitionClientImpl(Context context, GoogleApiClient.ConnectionCallbacks callbacks, GoogleApiClient.OnConnectionFailedListener connectionFailedListener) {
- super(context, callbacks, connectionFailedListener);
- }
-
- public void requestActivityUpdates(long detectionIntervalMillis, PendingIntent callbackIntent) throws RemoteException {
- getServiceInterface().requestActivityUpdates(detectionIntervalMillis, true, callbackIntent);
- }
-
- public void removeActivityUpdates(PendingIntent callbackIntent) throws RemoteException {
- getServiceInterface().removeActivityUpdates(callbackIntent);
- }
-}
diff --git a/play-services-location/src/main/java/org/microg/gms/location/FusedLocationProviderApiImpl.java b/play-services-location/src/main/java/org/microg/gms/location/FusedLocationProviderApiImpl.java
deleted file mode 100644
index 0069974c..00000000
--- a/play-services-location/src/main/java/org/microg/gms/location/FusedLocationProviderApiImpl.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.location;
-
-import android.app.PendingIntent;
-import android.location.Location;
-import android.os.Looper;
-import android.os.RemoteException;
-import android.util.Log;
-
-import com.google.android.gms.common.api.GoogleApiClient;
-import com.google.android.gms.common.api.PendingResult;
-import com.google.android.gms.common.api.Result;
-import com.google.android.gms.common.api.Status;
-import com.google.android.gms.location.FusedLocationProviderApi;
-import com.google.android.gms.location.LocationListener;
-import com.google.android.gms.location.LocationRequest;
-import com.google.android.gms.location.LocationServices;
-
-import org.microg.gms.common.GmsConnector;
-import org.microg.gms.common.api.ApiConnection;
-
-public class FusedLocationProviderApiImpl implements FusedLocationProviderApi {
- private static final String TAG = "GmsFusedApiImpl";
-
- @Override
- public Location getLastLocation(GoogleApiClient client) {
- try {
- Log.d(TAG, "getLastLocation(" + client + ")");
- return LocationClientImpl.get(client).getLastLocation();
- } catch (RemoteException e) {
- Log.w(TAG, e);
- return null;
- }
- }
-
- @Override
- public PendingResult requestLocationUpdates(GoogleApiClient client,
- final LocationRequest request, final LocationListener listener) {
- return callVoid(client, new Runnable() {
- @Override
- public void run(LocationClientImpl client) throws RemoteException {
- client.requestLocationUpdates(request, listener);
- }
- });
- }
-
- @Override
- public PendingResult requestLocationUpdates(GoogleApiClient client,
- final LocationRequest request, final LocationListener listener,
- final Looper looper) {
- return callVoid(client, new Runnable() {
- @Override
- public void run(LocationClientImpl client) throws RemoteException {
- client.requestLocationUpdates(request, listener, looper);
- }
- });
- }
-
- @Override
- public PendingResult requestLocationUpdates(GoogleApiClient client,
- final LocationRequest request, final PendingIntent callbackIntent) {
- return callVoid(client, new Runnable() {
- @Override
- public void run(LocationClientImpl client) throws RemoteException {
- client.requestLocationUpdates(request, callbackIntent);
- }
- });
- }
-
- @Override
- public PendingResult removeLocationUpdates(GoogleApiClient client,
- final LocationListener listener) {
- return callVoid(client, new Runnable() {
- @Override
- public void run(LocationClientImpl client) throws RemoteException {
- client.removeLocationUpdates(listener);
- }
- });
- }
-
- @Override
- public PendingResult removeLocationUpdates(GoogleApiClient client,
- final PendingIntent callbackIntent) {
- return callVoid(client, new Runnable() {
- @Override
- public void run(LocationClientImpl client) throws RemoteException {
- client.removeLocationUpdates(callbackIntent);
- }
- });
- }
-
- @Override
- public PendingResult setMockMode(GoogleApiClient client, final boolean isMockMode) {
- return callVoid(client, new Runnable() {
- @Override
- public void run(LocationClientImpl client) throws RemoteException {
- client.setMockMode(isMockMode);
- }
- });
- }
-
- @Override
- public PendingResult setMockLocation(GoogleApiClient client, final Location mockLocation) {
- return callVoid(client, new Runnable() {
- @Override
- public void run(LocationClientImpl client) throws RemoteException {
- client.setMockLocation(mockLocation);
- }
- });
- }
-
- private PendingResult callVoid(GoogleApiClient client, final Runnable runnable) {
- return GmsConnector.call(client, LocationServices.API, new GmsConnector.Callback() {
- @Override
- public void onClientAvailable(LocationClientImpl client, ResultProvider resultProvider) throws RemoteException {
- runnable.run(client);
- resultProvider.onResultAvailable(Status.SUCCESS);
- }
- });
- }
-
- private interface Runnable {
- void run(LocationClientImpl client) throws RemoteException;
- }
-}
diff --git a/play-services-location/src/main/java/org/microg/gms/location/GeofencingApiImpl.java b/play-services-location/src/main/java/org/microg/gms/location/GeofencingApiImpl.java
deleted file mode 100644
index aed9276d..00000000
--- a/play-services-location/src/main/java/org/microg/gms/location/GeofencingApiImpl.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.location;
-
-import android.app.PendingIntent;
-import android.os.RemoteException;
-import android.support.annotation.NonNull;
-import android.util.Log;
-
-import com.google.android.gms.common.api.GoogleApiClient;
-import com.google.android.gms.common.api.PendingResult;
-import com.google.android.gms.common.api.Status;
-import com.google.android.gms.location.Geofence;
-import com.google.android.gms.location.GeofencingApi;
-import com.google.android.gms.location.GeofencingRequest;
-import com.google.android.gms.location.LocationServices;
-import com.google.android.gms.location.internal.IGeofencerCallbacks;
-import com.google.android.gms.location.internal.ParcelableGeofence;
-
-import org.microg.gms.common.GmsConnector;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class GeofencingApiImpl implements GeofencingApi {
- @Override
- public PendingResult addGeofences(GoogleApiClient client, final GeofencingRequest geofencingRequest, final PendingIntent pendingIntent) {
- return callGeofencer(client, new Runnable() {
- @Override
- public void run(LocationClientImpl client, IGeofencerCallbacks callbacks) throws RemoteException {
- client.addGeofences(geofencingRequest, pendingIntent, callbacks);
- }
- });
- }
-
- @Override
- public PendingResult addGeofences(GoogleApiClient client, final List geofences, final PendingIntent pendingIntent) {
- final List geofenceList = new ArrayList();
- for (Geofence geofence : geofences) {
- if (geofence instanceof ParcelableGeofence) geofenceList.add((ParcelableGeofence) geofence);
- }
- return callGeofencer(client, new Runnable() {
- @Override
- public void run(LocationClientImpl client, IGeofencerCallbacks callbacks) throws RemoteException {
- client.addGeofences(geofenceList, pendingIntent, callbacks);
- }
- });
- }
-
- @Override
- public PendingResult removeGeofences(GoogleApiClient client, final List geofenceRequestIds) {
- return callGeofencer(client, new Runnable() {
- @Override
- public void run(LocationClientImpl client, IGeofencerCallbacks callbacks) throws RemoteException {
- client.removeGeofences(geofenceRequestIds, callbacks);
- }
- });
- }
-
- @Override
- public PendingResult removeGeofences(GoogleApiClient client, final PendingIntent pendingIntent) {
- return callGeofencer(client, new Runnable() {
- @Override
- public void run(LocationClientImpl client, IGeofencerCallbacks callbacks) throws RemoteException {
- client.removeGeofences(pendingIntent, callbacks);
- }
- });
- }
-
- @NonNull
- private IGeofencerCallbacks.Stub createGeofencerCallbacks(final GmsConnector.Callback.ResultProvider resultProvider) {
- return new IGeofencerCallbacks.Stub(){
- @Override
- public void onAddGeofenceResult(int statusCode, String[] requestIds) throws RemoteException {
- resultProvider.onResultAvailable(new Status(statusCode));
- }
-
- @Override
- public void onRemoveGeofencesByRequestIdsResult(int statusCode, String[] requestIds) throws RemoteException {
- resultProvider.onResultAvailable(new Status(statusCode));
- }
-
- @Override
- public void onRemoveGeofencesByPendingIntentResult(int statusCode, PendingIntent pendingIntent) throws RemoteException {
- resultProvider.onResultAvailable(new Status(statusCode));
- }
- };
- }
-
- private PendingResult callGeofencer(GoogleApiClient client, final Runnable runnable) {
- return GmsConnector.call(client, LocationServices.API, new GmsConnector.Callback() {
- @Override
- public void onClientAvailable(LocationClientImpl client, ResultProvider resultProvider) throws RemoteException {
- runnable.run(client, createGeofencerCallbacks(resultProvider));
- }
- });
- }
-
- private interface Runnable {
- void run(LocationClientImpl client, IGeofencerCallbacks callbacks) throws RemoteException;
- }
-}
diff --git a/play-services-location/src/main/java/org/microg/gms/location/GoogleLocationManagerClient.java b/play-services-location/src/main/java/org/microg/gms/location/GoogleLocationManagerClient.java
deleted file mode 100644
index 55d0fae9..00000000
--- a/play-services-location/src/main/java/org/microg/gms/location/GoogleLocationManagerClient.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.location;
-
-import android.content.Context;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.RemoteException;
-
-import com.google.android.gms.common.api.GoogleApiClient;
-import com.google.android.gms.common.internal.IGmsServiceBroker;
-import com.google.android.gms.location.internal.IGoogleLocationManagerService;
-
-import org.microg.gms.common.Constants;
-import org.microg.gms.common.GmsClient;
-import org.microg.gms.common.GmsService;
-
-public abstract class GoogleLocationManagerClient extends GmsClient {
- public GoogleLocationManagerClient(Context context, GoogleApiClient.ConnectionCallbacks
- callbacks, GoogleApiClient.OnConnectionFailedListener connectionFailedListener) {
- super(context, callbacks, connectionFailedListener, GmsService.LOCATION_MANAGER.ACTION);
- }
-
- @Override
- protected IGoogleLocationManagerService interfaceFromBinder(IBinder binder) {
- return IGoogleLocationManagerService.Stub.asInterface(binder);
- }
-
- @Override
- protected void onConnectedToBroker(IGmsServiceBroker broker, GmsCallbacks callbacks)
- throws RemoteException {
- Bundle bundle = new Bundle();
- bundle.putString("client_name", "locationServices");
- broker.getGoogleLocationManagerService(callbacks, Constants.MAX_REFERENCE_VERSION,
- getContext().getPackageName(), bundle);
- }
-}
diff --git a/play-services-location/src/main/java/org/microg/gms/location/LocationClientImpl.java b/play-services-location/src/main/java/org/microg/gms/location/LocationClientImpl.java
deleted file mode 100644
index bc161d13..00000000
--- a/play-services-location/src/main/java/org/microg/gms/location/LocationClientImpl.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.location;
-
-import android.app.PendingIntent;
-import android.content.Context;
-import android.location.Location;
-import android.os.Bundle;
-import android.os.Looper;
-import android.os.RemoteException;
-import android.util.Log;
-
-import com.google.android.gms.common.api.GoogleApiClient;
-import com.google.android.gms.location.GeofencingRequest;
-import com.google.android.gms.location.ILocationListener;
-import com.google.android.gms.location.LocationListener;
-import com.google.android.gms.location.LocationRequest;
-import com.google.android.gms.location.LocationServices;
-import com.google.android.gms.location.internal.IGeofencerCallbacks;
-import com.google.android.gms.location.internal.ParcelableGeofence;
-
-import org.microg.gms.common.api.GoogleApiClientImpl;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class LocationClientImpl extends GoogleLocationManagerClient {
- private static final String TAG = "GmsLocationClientImpl";
- private NativeLocationClientImpl nativeLocation = null;
- private Map listenerMap = new HashMap();
-
-
- public LocationClientImpl(Context context, GoogleApiClient.ConnectionCallbacks callbacks,
- GoogleApiClient.OnConnectionFailedListener connectionFailedListener) {
- super(context, callbacks, connectionFailedListener);
- Log.d(TAG, "");
- }
-
- public static LocationClientImpl get(GoogleApiClient apiClient) {
- if (apiClient instanceof GoogleApiClientImpl) {
- return (LocationClientImpl) ((GoogleApiClientImpl) apiClient)
- .getApiConnection(LocationServices.API);
- }
- return null;
- }
-
- public void addGeofences(GeofencingRequest request, PendingIntent pendingIntent, IGeofencerCallbacks callbacks) throws RemoteException {
- if (nativeLocation != null) {
- nativeLocation.addGeofences(request, pendingIntent, callbacks);
- } else {
- getServiceInterface().addGeofences(request, pendingIntent, callbacks);
- }
- }
-
- public void addGeofences(List request, PendingIntent pendingIntent, IGeofencerCallbacks callbacks) throws RemoteException {
- if (nativeLocation != null) {
- nativeLocation.addGeofences(request, pendingIntent, callbacks);
- } else {
- getServiceInterface().addGeofencesList(request, pendingIntent, callbacks, getContext().getPackageName());
- }
- }
-
- public void removeGeofences(List geofenceRequestIds, IGeofencerCallbacks callbacks) throws RemoteException {
- if (nativeLocation != null) {
- nativeLocation.removeGeofences(geofenceRequestIds, callbacks);
- } else {
- getServiceInterface().removeGeofencesById(geofenceRequestIds.toArray(new String[geofenceRequestIds.size()]), callbacks, getContext().getPackageName());
- }
- }
-
- public void removeGeofences(PendingIntent pendingIntent, IGeofencerCallbacks callbacks) throws RemoteException {
- if (nativeLocation != null) {
- nativeLocation.removeGeofences(pendingIntent, callbacks);
- } else {
- getServiceInterface().removeGeofencesByIntent(pendingIntent, callbacks, getContext().getPackageName());
- }
- }
-
- public Location getLastLocation() throws RemoteException {
- Log.d(TAG, "getLastLocation()");
- if (nativeLocation != null) {
- return nativeLocation.getLastLocation();
- } else {
- return getServiceInterface().getLastLocation();
- }
- }
-
- public void requestLocationUpdates(LocationRequest request, final LocationListener listener)
- throws RemoteException {
- if (nativeLocation != null) {
- nativeLocation.requestLocationUpdates(request, listener);
- } else {
- if (!listenerMap.containsKey(listener)) {
- listenerMap.put(listener, new ILocationListener.Stub() {
- @Override
- public void onLocationChanged(Location location) throws RemoteException {
- listener.onLocationChanged(location);
- }
- });
- }
- getServiceInterface().requestLocationUpdatesWithPackage(request,
- listenerMap.get(listener), getContext().getPackageName());
- }
- }
-
- public void requestLocationUpdates(LocationRequest request, PendingIntent pendingIntent)
- throws RemoteException {
- if (nativeLocation != null) {
- nativeLocation.requestLocationUpdates(request, pendingIntent);
- } else {
- getServiceInterface().requestLocationUpdatesWithIntent(request, pendingIntent);
- }
- }
-
- public void requestLocationUpdates(LocationRequest request, LocationListener listener,
- Looper looper) throws RemoteException {
- if (nativeLocation != null) {
- nativeLocation.requestLocationUpdates(request, listener, looper);
- }
- requestLocationUpdates(request, listener); // TODO
- }
-
- public void removeLocationUpdates(LocationListener listener) throws RemoteException {
- if (nativeLocation != null) {
- nativeLocation.removeLocationUpdates(listener);
- } else {
- getServiceInterface().removeLocationUpdatesWithListener(listenerMap.get(listener));
- }
- }
-
- public void removeLocationUpdates(PendingIntent pendingIntent) throws RemoteException {
- if (nativeLocation != null) {
- nativeLocation.removeLocationUpdates(pendingIntent);
- } else {
- getServiceInterface().removeLocationUpdatesWithIntent(pendingIntent);
- }
- }
-
- public void setMockMode(boolean isMockMode) throws RemoteException {
- if (nativeLocation != null) {
- nativeLocation.setMockMode(isMockMode);
- } else {
- getServiceInterface().setMockMode(isMockMode);
- }
- }
-
- public void setMockLocation(Location mockLocation) throws RemoteException {
- if (nativeLocation != null) {
- nativeLocation.setMockLocation(mockLocation);
- } else {
- getServiceInterface().setMockLocation(mockLocation);
- }
- }
-
- @Override
- public void handleConnectionFailed() {
- // DO NOT call super here, because fails are not really problems :)
- nativeLocation = new NativeLocationClientImpl(this);
- state = ConnectionState.PSEUDO_CONNECTED;
- Bundle bundle = new Bundle();
- bundle.putBoolean("fallback_to_native_active", true);
- callbacks.onConnected(bundle);
- }
-}
diff --git a/play-services-location/src/main/java/org/microg/gms/location/LocationServicesApiBuilder.java b/play-services-location/src/main/java/org/microg/gms/location/LocationServicesApiBuilder.java
deleted file mode 100644
index 2e053a81..00000000
--- a/play-services-location/src/main/java/org/microg/gms/location/LocationServicesApiBuilder.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.location;
-
-import android.content.Context;
-import android.os.Looper;
-
-import com.google.android.gms.common.api.AccountInfo;
-import com.google.android.gms.common.api.Api;
-import com.google.android.gms.common.api.GoogleApiClient;
-
-import org.microg.gms.common.api.ApiBuilder;
-import org.microg.gms.common.api.ApiConnection;
-
-public class LocationServicesApiBuilder implements ApiBuilder {
- @Override
- public ApiConnection build(Context context, Looper looper,
- Api.ApiOptions.NoOptions options,
- AccountInfo accountInfo, GoogleApiClient.ConnectionCallbacks callbacks,
- GoogleApiClient.OnConnectionFailedListener connectionFailedListener) {
- return new LocationClientImpl(context, callbacks, connectionFailedListener);
- }
-}
diff --git a/play-services-location/src/main/java/org/microg/gms/location/NativeLocationClientImpl.java b/play-services-location/src/main/java/org/microg/gms/location/NativeLocationClientImpl.java
deleted file mode 100644
index 17a017d9..00000000
--- a/play-services-location/src/main/java/org/microg/gms/location/NativeLocationClientImpl.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.location;
-
-import android.app.PendingIntent;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.location.Criteria;
-import android.location.Location;
-import android.location.LocationManager;
-import android.os.Bundle;
-import android.os.Looper;
-import android.os.RemoteException;
-import android.os.SystemClock;
-import android.util.Log;
-
-import com.google.android.gms.common.api.CommonStatusCodes;
-import com.google.android.gms.location.FusedLocationProviderApi;
-import com.google.android.gms.location.Geofence;
-import com.google.android.gms.location.GeofenceStatusCodes;
-import com.google.android.gms.location.GeofencingEvent;
-import com.google.android.gms.location.GeofencingRequest;
-import com.google.android.gms.location.LocationListener;
-import com.google.android.gms.location.LocationRequest;
-import com.google.android.gms.location.internal.IGeofencerCallbacks;
-import com.google.android.gms.location.internal.ParcelableGeofence;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static android.location.LocationManager.KEY_LOCATION_CHANGED;
-import static android.location.LocationManager.KEY_PROXIMITY_ENTERING;
-
-@SuppressWarnings("MissingPermission")
-public class NativeLocationClientImpl {
- private final static String TAG = "GmsToNativeLocClient";
- private final static Criteria DEFAULT_CRITERIA = new Criteria();
- private final static Map pendingCount = new HashMap();
- private final static Map nativePendingMap = new HashMap();
- private static final String EXTRA_PENDING_INTENT = "pending_intent";
-
- private final Context context;
- private final LocationManager locationManager;
- private final Map nativeListenerMap = new HashMap();
-
- public NativeLocationClientImpl(LocationClientImpl client) {
- context = client.getContext();
- locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
- }
-
- private static Criteria makeNativeCriteria(LocationRequest request) {
- Criteria criteria = new Criteria();
- switch (request.getPriority()) {
- case LocationRequest.PRIORITY_HIGH_ACCURACY:
- criteria.setAccuracy(Criteria.ACCURACY_FINE);
- criteria.setPowerRequirement(Criteria.POWER_HIGH);
- break;
- case LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY:
- default:
- criteria.setAccuracy(Criteria.ACCURACY_COARSE);
- criteria.setPowerRequirement(Criteria.POWER_MEDIUM);
- break;
- case LocationRequest.PRIORITY_NO_POWER:
- case LocationRequest.PRIORITY_LOW_POWER:
- criteria.setAccuracy(Criteria.ACCURACY_COARSE);
- criteria.setPowerRequirement(Criteria.POWER_LOW);
- }
- return criteria;
- }
-
- public void addGeofences(GeofencingRequest geofencingRequest, PendingIntent pendingIntent, IGeofencerCallbacks callbacks) throws RemoteException {
- Log.d(TAG, "addGeofences(GeofencingRequest)");
- callbacks.onAddGeofenceResult(GeofenceStatusCodes.GEOFENCE_NOT_AVAILABLE, new String[0]);
- }
-
- public void addGeofences(List geofences, PendingIntent pendingIntent, IGeofencerCallbacks callbacks) throws RemoteException {
- Log.d(TAG, "addGeofences(List)");
- Intent i = new Intent(context, NativePendingIntentForwarder.class);
- Bundle bundle = new Bundle();
- bundle.putParcelable(EXTRA_PENDING_INTENT, pendingIntent);
- i.putExtras(bundle);
- nativePendingMap.put(pendingIntent, PendingIntent.getActivity(context, 0, i, 0));
- List requestIds = new ArrayList();
- for (ParcelableGeofence geofence : geofences) {
- locationManager.addProximityAlert(geofence.latitude, geofence.longitude, geofence.radius,
- geofence.expirationTime - SystemClock.elapsedRealtime(), nativePendingMap.get(pendingIntent));
- requestIds.add(geofence.getRequestId());
- }
- callbacks.onAddGeofenceResult(CommonStatusCodes.SUCCESS, requestIds.toArray(new String[requestIds.size()]));
- }
-
- public void removeGeofences(List requestIds, IGeofencerCallbacks callbacks) throws RemoteException {
- Log.d(TAG, "removeGeofences(List)");
- callbacks.onRemoveGeofencesByRequestIdsResult(GeofenceStatusCodes.ERROR, requestIds.toArray(new String[requestIds.size()]));
- }
-
- public void removeGeofences(PendingIntent pendingIntent, IGeofencerCallbacks callbacks) throws RemoteException {
- Log.d(TAG, "removeGeofences(PendingIntent)");
- locationManager.removeProximityAlert(nativePendingMap.get(pendingIntent));
- nativePendingMap.remove(pendingIntent);
- callbacks.onRemoveGeofencesByPendingIntentResult(CommonStatusCodes.SUCCESS, pendingIntent);
- }
-
- public Location getLastLocation() {
- Log.d(TAG, "getLastLocation()");
- return locationManager.getLastKnownLocation(locationManager.getBestProvider(DEFAULT_CRITERIA, true));
- }
-
- public void requestLocationUpdates(LocationRequest request, LocationListener listener) {
- requestLocationUpdates(request, listener, Looper.getMainLooper());
- }
-
- public void requestLocationUpdates(LocationRequest request, PendingIntent pendingIntent) {
- Log.d(TAG, "requestLocationUpdates()");
- Intent i = new Intent(context, NativePendingIntentForwarder.class);
- Bundle bundle = new Bundle();
- bundle.putParcelable(EXTRA_PENDING_INTENT, pendingIntent);
- i.putExtras(bundle);
- pendingCount.put(pendingIntent, request.getNumUpdates());
- nativePendingMap.put(pendingIntent, PendingIntent.getActivity(context, 0, i, 0));
- locationManager.requestLocationUpdates(request.getInterval(), request.getSmallestDesplacement(),
- makeNativeCriteria(request), nativePendingMap.get(pendingIntent));
- }
-
- public void requestLocationUpdates(LocationRequest request, LocationListener listener, Looper
- looper) {
- Log.d(TAG, "requestLocationUpdates()");
- if (nativeListenerMap.containsKey(listener)) {
- removeLocationUpdates(listener);
- }
- nativeListenerMap.put(listener, new NativeListener(listener, request.getNumUpdates()));
- locationManager.requestLocationUpdates(request.getInterval(),
- request.getSmallestDesplacement(), makeNativeCriteria(request),
- nativeListenerMap.get(listener), looper);
- }
-
- public void removeLocationUpdates(LocationListener listener) {
- Log.d(TAG, "removeLocationUpdates()");
- locationManager.removeUpdates(nativeListenerMap.get(listener));
- nativeListenerMap.remove(listener);
- }
-
- public void removeLocationUpdates(PendingIntent pendingIntent) {
- Log.d(TAG, "removeLocationUpdates()");
- locationManager.removeUpdates(nativePendingMap.get(pendingIntent));
- nativePendingMap.remove(pendingIntent);
- pendingCount.remove(pendingIntent);
- }
-
- public void setMockMode(boolean isMockMode) {
- Log.d(TAG, "setMockMode()");
- // not yet supported
- }
-
- public void setMockLocation(Location mockLocation) {
- Log.d(TAG, "setMockLocation()");
- // not yet supported
- }
-
- public static class NativePendingIntentForwarder extends BroadcastReceiver {
-
- @Override
- public void onReceive(Context context, Intent intent) {
- if (intent.hasExtra(KEY_PROXIMITY_ENTERING)) {
- PendingIntent pendingIntent = intent.getExtras().getParcelable(EXTRA_PENDING_INTENT);
- try {
- intent.putExtra(GeofencingEvent.EXTRA_TRANSITION, intent.getBooleanExtra(KEY_PROXIMITY_ENTERING, false) ? Geofence.GEOFENCE_TRANSITION_ENTER : Geofence.GEOFENCE_TRANSITION_EXIT);
- pendingIntent.send(context, 0, intent);
- } catch (PendingIntent.CanceledException e) {
- nativePendingMap.remove(pendingIntent);
- }
- } else if (intent.hasExtra(KEY_LOCATION_CHANGED)) {
- PendingIntent pendingIntent = intent.getExtras().getParcelable(EXTRA_PENDING_INTENT);
- try {
- intent.putExtra(FusedLocationProviderApi.KEY_LOCATION_CHANGED,
- intent.getParcelableExtra(KEY_LOCATION_CHANGED));
- pendingIntent.send(context, 0, intent);
- pendingCount.put(pendingIntent, pendingCount.get(pendingIntent) - 1);
- if (pendingCount.get(pendingIntent) == 0) {
- ((LocationManager) context.getSystemService(Context.LOCATION_SERVICE))
- .removeUpdates(nativePendingMap.get(pendingIntent));
- nativePendingMap.remove(pendingIntent);
- pendingCount.remove(pendingIntent);
- }
- } catch (PendingIntent.CanceledException e) {
- ((LocationManager) context.getSystemService(Context.LOCATION_SERVICE))
- .removeUpdates(nativePendingMap.get(pendingIntent));
- nativePendingMap.remove(pendingIntent);
- pendingCount.remove(pendingIntent);
- }
- }
- }
- }
-
- public class NativeListener implements android.location.LocationListener {
-
- private final LocationListener listener;
- private int count;
-
- private NativeListener(LocationListener listener, int count) {
- this.listener = listener;
- this.count = count;
- }
-
- @Override
- public void onLocationChanged(Location location) {
- listener.onLocationChanged(location);
- count--;
- if (count == 0) {
- locationManager.removeUpdates(this);
- nativeListenerMap.remove(listener);
- }
- }
-
- @Override
- public void onStatusChanged(String provider, int status, Bundle extras) {
-
- }
-
- @Override
- public void onProviderEnabled(String provider) {
-
- }
-
- @Override
- public void onProviderDisabled(String provider) {
-
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- NativeListener that = (NativeListener) o;
-
- if (!listener.equals(that.listener)) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return listener.hashCode();
- }
- }
-}
diff --git a/play-services-location/src/main/java/org/microg/gms/location/SettingsApiImpl.java b/play-services-location/src/main/java/org/microg/gms/location/SettingsApiImpl.java
deleted file mode 100644
index b8fe0ffe..00000000
--- a/play-services-location/src/main/java/org/microg/gms/location/SettingsApiImpl.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.location;
-
-import com.google.android.gms.common.api.GoogleApiClient;
-import com.google.android.gms.common.api.PendingResult;
-import com.google.android.gms.common.api.Status;
-import com.google.android.gms.location.LocationSettingsRequest;
-import com.google.android.gms.location.LocationSettingsResult;
-import com.google.android.gms.location.SettingsApi;
-
-import org.microg.gms.common.api.InstantPendingResult;
-
-public class SettingsApiImpl implements SettingsApi {
- @Override
- public PendingResult checkLocationSettings(GoogleApiClient client, LocationSettingsRequest locationSettingsRequest) {
- return new InstantPendingResult(new LocationSettingsResult(Status.CANCELED));
- }
-}
diff --git a/play-services-maps-core-mapbox/build.gradle b/play-services-maps-core-mapbox/build.gradle
deleted file mode 100644
index 8ae75a48..00000000
--- a/play-services-maps-core-mapbox/build.gradle
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2013-2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-apply plugin: 'com.android.library'
-apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-android-extensions'
-
-dependencies {
- implementation project(':play-services-api')
- implementation("com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.1") {
- exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-accounts'
- }
- implementation("com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.8.0") {
- exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-accounts'
- }
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
-}
-
-def execResult(...args) {
- def stdout = new ByteArrayOutputStream()
- exec {
- commandLine args
- standardOutput = stdout
- }
- return stdout.toString().trim()
-}
-
-def mapboxKey() {
- Properties properties = new Properties()
- properties.load(project.rootProject.file('local.properties').newDataInputStream())
- return properties.getProperty("mapbox.key", "invalid")
-}
-
-android {
- compileSdkVersion androidCompileSdk
- buildToolsVersion "$androidBuildVersionTools"
-
- defaultConfig {
- versionName version
- minSdkVersion androidMinSdk
- targetSdkVersion androidTargetSdk
- buildConfigField "String", "MAPBOX_KEY", "\"${mapboxKey()}\""
-
- ndk {
- abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
- }
- }
-
- sourceSets {
- main.java.srcDirs += 'src/main/kotlin'
- }
-
- lintOptions {
- disable 'GradleCompatible'
- }
-
- buildTypes {
- release {
- minifyEnabled true
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
-
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
-}
-
-if (file('user.gradle').exists()) {
- apply from: 'user.gradle'
-}
diff --git a/play-services-maps-core-mapbox/src/main/AndroidManifest.xml b/play-services-maps-core-mapbox/src/main/AndroidManifest.xml
deleted file mode 100644
index eef94459..00000000
--- a/play-services-maps-core-mapbox/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/play-services-maps-core-mapbox/src/main/java/com/google/android/gms/maps/internal/CreatorImpl.java b/play-services-maps-core-mapbox/src/main/java/com/google/android/gms/maps/internal/CreatorImpl.java
deleted file mode 100644
index 905015ba..00000000
--- a/play-services-maps-core-mapbox/src/main/java/com/google/android/gms/maps/internal/CreatorImpl.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.maps.internal;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.res.Resources;
-import android.os.Parcel;
-import android.os.RemoteException;
-import androidx.annotation.Keep;
-import android.util.Log;
-
-import com.google.android.gms.dynamic.IObjectWrapper;
-import com.google.android.gms.dynamic.ObjectWrapper;
-import com.google.android.gms.maps.GoogleMapOptions;
-import com.google.android.gms.maps.model.internal.IBitmapDescriptorFactoryDelegate;
-
-import org.microg.gms.maps.mapbox.CameraUpdateFactoryImpl;
-import org.microg.gms.maps.mapbox.MapFragmentImpl;
-import org.microg.gms.maps.mapbox.MapViewImpl;
-import org.microg.gms.maps.mapbox.model.BitmapDescriptorFactoryImpl;
-
-@Keep
-public class CreatorImpl extends ICreator.Stub {
- private static final String TAG = "GmsMapCreator";
-
- @Override
- public void init(IObjectWrapper resources) {
- initV2(resources, 0);
- }
-
- @Override
- public IMapFragmentDelegate newMapFragmentDelegate(IObjectWrapper activity) {
- return new MapFragmentImpl(ObjectWrapper.unwrapTyped(activity, Activity.class));
- }
-
- @Override
- public IMapViewDelegate newMapViewDelegate(IObjectWrapper context, GoogleMapOptions options) {
- return new MapViewImpl(ObjectWrapper.unwrapTyped(context, Context.class), options);
- }
-
- @Override
- public ICameraUpdateFactoryDelegate newCameraUpdateFactoryDelegate() {
- return new CameraUpdateFactoryImpl();
- }
-
- @Override
- public IBitmapDescriptorFactoryDelegate newBitmapDescriptorFactoryDelegate() {
- return BitmapDescriptorFactoryImpl.INSTANCE;
- }
-
- @Override
- public void initV2(IObjectWrapper resources, int flags) {
- BitmapDescriptorFactoryImpl.INSTANCE.initialize(ObjectWrapper.unwrapTyped(resources, Resources.class), null);
- //ResourcesContainer.set((Resources) ObjectWrapper.unwrap(resources));
- Log.d(TAG, "initV2 " + flags);
- }
-
- @Override
- public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
- if (super.onTransact(code, data, reply, flags)) return true;
- Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags);
- return false;
- }
-}
diff --git a/play-services-maps-core-mapbox/src/main/java/com/mapbox/android/accounts/v1/MapboxAccounts.java b/play-services-maps-core-mapbox/src/main/java/com/mapbox/android/accounts/v1/MapboxAccounts.java
deleted file mode 100644
index 1319a19f..00000000
--- a/play-services-maps-core-mapbox/src/main/java/com/mapbox/android/accounts/v1/MapboxAccounts.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.mapbox.android.accounts.v1;
-
-import java.util.UUID;
-
-/**
- * This class is used from within the Mapbox library
- */
-@SuppressWarnings("unused")
-public class MapboxAccounts {
- public final static String SKU_ID_MAPS_MAUS = "00";
- private final static String MAPS_SKU_PREFIX = "100";
-
- /**
- * Generates random UUID without hyphens
- */
- public static String obtainEndUserId() {
- String uuid = UUID.randomUUID().toString();
- return uuid.substring(0, 8) + uuid.substring(9, 13) + uuid.substring(14, 18) + uuid.substring(19, 23) + uuid.substring(24, 36);
- }
-
- /**
- * Generates a SKU which is the user id prefixed with 100 and base-36 encoded timestamp
- */
- public static String obtainMapsSkuUserToken(String userId) {
- String stamp = Long.toString(System.currentTimeMillis(), 36);
- return MAPS_SKU_PREFIX + stamp + userId;
- }
-}
diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/CameraBoundsWithSizeUpdate.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/CameraBoundsWithSizeUpdate.kt
deleted file mode 100644
index eea4304f..00000000
--- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/CameraBoundsWithSizeUpdate.kt
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.mapbox
-
-import android.util.Log
-import com.mapbox.mapboxsdk.camera.CameraPosition
-import com.mapbox.mapboxsdk.camera.CameraUpdate
-import com.mapbox.mapboxsdk.geometry.LatLngBounds
-import com.mapbox.mapboxsdk.maps.MapboxMap
-import java.util.*
-
-internal class CameraBoundsWithSizeUpdate(val bounds: LatLngBounds, val width: Int, val height: Int, val padding: IntArray) : CameraUpdate {
-
- constructor(bounds: LatLngBounds, width: Int, height: Int, paddingLeft: Int, paddingTop: Int = paddingLeft, paddingRight: Int = paddingLeft, paddingBottom: Int = paddingTop) : this(bounds, width, height, intArrayOf(paddingLeft, paddingTop, paddingRight, paddingBottom)) {}
-
- override fun getCameraPosition(map: MapboxMap): CameraPosition? {
- val padding = this.padding.clone()
- val widthPad = ((map.width + map.padding[0] + map.padding[2] - width) / 2).toInt()
- val heightPad = ((map.height + map.padding[1] + map.padding[3] - height) / 2).toInt()
- padding[0] += widthPad
- padding[1] += heightPad
- padding[2] += widthPad
- padding[3] += heightPad
- Log.d(TAG, "map ${map.width} ${map.height}, set $width $height -> ${padding.map { it.toString() }.reduce { a, b -> "$a,$b"}}")
- return map.getCameraForLatLngBounds(bounds, padding)
- }
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
- if (other == null || other !is CameraBoundsWithSizeUpdate?) {
- return false
- }
-
- val that = other as CameraBoundsWithSizeUpdate? ?: return false
-
- if (bounds != that.bounds) {
- return false
- }
-
- if (Arrays.equals(padding, that.padding)) {
- return false
- }
-
- if (height != that.height || width != that.width) {
- return false
- }
-
- return true
- }
-
- override fun hashCode(): Int {
- var result = bounds.hashCode()
- result = 31 * result + Arrays.hashCode(padding)
- result = 31 * result + height.hashCode()
- result = 31 * result + width.hashCode()
- return result
- }
-
- override fun toString(): String {
- return ("CameraBoundsWithSizeUpdate{"
- + "bounds=" + bounds
- + ", padding=" + Arrays.toString(padding)
- + '}'.toString())
- }
-
- companion object {
- const val TAG = "GmsMapCameraBounds"
- }
-}
\ No newline at end of file
diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/CameraUpdateFactory.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/CameraUpdateFactory.kt
deleted file mode 100644
index 675429b9..00000000
--- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/CameraUpdateFactory.kt
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.mapbox
-
-import android.graphics.Point
-import android.os.Parcel
-import android.util.Log
-import com.google.android.gms.dynamic.IObjectWrapper
-import com.google.android.gms.dynamic.ObjectWrapper
-import com.google.android.gms.maps.internal.ICameraUpdateFactoryDelegate
-import com.google.android.gms.maps.model.CameraPosition
-import com.google.android.gms.maps.model.LatLng
-import com.google.android.gms.maps.model.LatLngBounds
-import com.mapbox.mapboxsdk.camera.CameraUpdate
-import com.mapbox.mapboxsdk.camera.CameraUpdateFactory
-import com.mapbox.mapboxsdk.maps.MapboxMap
-import org.microg.gms.maps.mapbox.utils.toMapbox
-
-class CameraUpdateFactoryImpl : ICameraUpdateFactoryDelegate.Stub() {
-
- override fun zoomIn(): IObjectWrapper = ObjectWrapper.wrap(CameraUpdateFactory.zoomIn())
- override fun zoomOut(): IObjectWrapper = ObjectWrapper.wrap(CameraUpdateFactory.zoomOut())
-
- override fun zoomTo(zoom: Float): IObjectWrapper =
- ObjectWrapper.wrap(CameraUpdateFactory.zoomTo(zoom.toDouble() - 1.0))
-
- override fun zoomBy(zoomDelta: Float): IObjectWrapper =
- ObjectWrapper.wrap(CameraUpdateFactory.zoomBy(zoomDelta.toDouble()))
-
- override fun zoomByWithFocus(zoomDelta: Float, x: Int, y: Int): IObjectWrapper =
- ObjectWrapper.wrap(CameraUpdateFactory.zoomBy(zoomDelta.toDouble(), Point(x, y)))
-
- override fun newCameraPosition(cameraPosition: CameraPosition): IObjectWrapper =
- ObjectWrapper.wrap(CameraUpdateFactory.newCameraPosition(cameraPosition.toMapbox()))
-
- override fun newLatLng(latLng: LatLng): IObjectWrapper =
- ObjectWrapper.wrap(CameraUpdateFactory.newLatLng(latLng.toMapbox()))
-
- override fun newLatLngZoom(latLng: LatLng, zoom: Float): IObjectWrapper =
- ObjectWrapper.wrap(CameraUpdateFactory.newLatLngZoom(latLng.toMapbox(), zoom.toDouble() - 1.0))
-
- override fun newLatLngBounds(bounds: LatLngBounds, padding: Int): IObjectWrapper =
- ObjectWrapper.wrap(CameraUpdateFactory.newLatLngBounds(bounds.toMapbox(), padding))
-
- override fun scrollBy(x: Float, y: Float): IObjectWrapper {
- Log.d(TAG, "unimplemented Method: scrollBy")
- return ObjectWrapper.wrap(NoCameraUpdate())
- }
-
- override fun newLatLngBoundsWithSize(bounds: LatLngBounds, width: Int, height: Int, padding: Int): IObjectWrapper =
- ObjectWrapper.wrap(CameraBoundsWithSizeUpdate(bounds.toMapbox(), width, height, padding))
-
- override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean =
- if (super.onTransact(code, data, reply, flags)) {
- true
- } else {
- Log.d(TAG, "onTransact [unknown]: $code, $data, $flags"); false
- }
-
- private inner class NoCameraUpdate : CameraUpdate {
- override fun getCameraPosition(mapboxMap: MapboxMap): com.mapbox.mapboxsdk.camera.CameraPosition? =
- mapboxMap.cameraPosition
- }
-
- companion object {
- private val TAG = "GmsCameraUpdate"
- }
-}
-
-
diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/GoogleMap.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/GoogleMap.kt
deleted file mode 100644
index ffc854b8..00000000
--- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/GoogleMap.kt
+++ /dev/null
@@ -1,775 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.mapbox
-
-import android.annotation.SuppressLint
-import android.app.Activity
-import android.content.Context
-import android.location.Location
-import android.os.*
-import androidx.annotation.IdRes
-import androidx.annotation.Keep
-import android.util.DisplayMetrics
-import android.util.Log
-import android.view.Gravity
-import android.view.View
-import android.widget.FrameLayout
-import android.widget.RelativeLayout
-import androidx.collection.LongSparseArray
-import com.google.android.gms.dynamic.IObjectWrapper
-import com.google.android.gms.maps.GoogleMapOptions
-import com.google.android.gms.maps.internal.*
-import com.google.android.gms.maps.model.*
-import com.google.android.gms.maps.model.CircleOptions
-import com.google.android.gms.maps.model.internal.*
-import com.mapbox.mapboxsdk.LibraryLoader
-import com.mapbox.mapboxsdk.Mapbox
-import com.mapbox.mapboxsdk.R
-import com.mapbox.mapboxsdk.camera.CameraUpdate
-import com.mapbox.mapboxsdk.constants.MapboxConstants
-import com.mapbox.mapboxsdk.maps.MapView
-import com.mapbox.mapboxsdk.maps.MapboxMap
-import com.mapbox.mapboxsdk.maps.Style
-import com.mapbox.mapboxsdk.plugins.annotation.*
-import com.mapbox.mapboxsdk.plugins.annotation.Annotation
-import com.mapbox.mapboxsdk.style.layers.Property.LINE_CAP_ROUND
-import com.mapbox.mapboxsdk.utils.ColorUtils
-import com.mapbox.mapboxsdk.utils.ThreadUtils
-import org.microg.gms.kotlin.unwrap
-import org.microg.gms.maps.MapsConstants.*
-import org.microg.gms.maps.mapbox.model.*
-import org.microg.gms.maps.mapbox.utils.MapContext
-import org.microg.gms.maps.mapbox.utils.MultiArchLoader
-import org.microg.gms.maps.mapbox.utils.toGms
-import org.microg.gms.maps.mapbox.utils.toMapbox
-
-private fun LongSparseArray.values() = (0..size()).map { valueAt(it) }.mapNotNull { it }
-
-fun runOnMainLooper(method: () -> Unit) {
- if (Looper.myLooper() == Looper.getMainLooper()) {
- method()
- } else {
- Handler(Looper.getMainLooper()).post {
- method()
- }
- }
-}
-
-class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions) : IGoogleMapDelegate.Stub() {
-
- val view: FrameLayout
- var map: MapboxMap? = null
- private set
- val dpiFactor: Float
- get() = context.resources.displayMetrics.densityDpi.toFloat() / DisplayMetrics.DENSITY_DEFAULT
-
- private var mapView: MapView? = null
- private var created = false
- private var initialized = false
- private var loaded = false
- private val mapLock = Object()
-
- private val initializedCallbackList = mutableListOf()
- private var loadedCallback: IOnMapLoadedCallback? = null
- private var cameraChangeListener: IOnCameraChangeListener? = null
- private var cameraMoveListener: IOnCameraMoveListener? = null
- private var cameraMoveCanceledListener: IOnCameraMoveCanceledListener? = null
- private var cameraMoveStartedListener: IOnCameraMoveStartedListener? = null
- private var cameraIdleListener: IOnCameraIdleListener? = null
- private var mapClickListener: IOnMapClickListener? = null
- private var mapLongClickListener: IOnMapLongClickListener? = null
- private var markerClickListener: IOnMarkerClickListener? = null
- private var markerDragListener: IOnMarkerDragListener? = null
-
- var lineManager: LineManager? = null
- val pendingLines = mutableSetOf()
- var lineId = 0L
-
- var fillManager: FillManager? = null
- val pendingFills = mutableSetOf()
- var fillId = 0L
-
- var circleManager: CircleManager? = null
- val pendingCircles = mutableSetOf()
- var circleId = 0L
-
- var symbolManager: SymbolManager? = null
- val pendingMarkers = mutableSetOf()
- val markers = mutableMapOf()
- var markerId = 0L
-
- var storedMapType: Int = options.mapType
- val waitingCameraUpdates = mutableListOf()
-
- init {
- val mapContext = MapContext(context)
- BitmapDescriptorFactoryImpl.initialize(mapContext.resources, context.resources)
- LibraryLoader.setLibraryLoader(MultiArchLoader(mapContext, context))
- runOnMainLooper {
- Mapbox.getInstance(mapContext, BuildConfig.MAPBOX_KEY)
- }
-
-
- val fakeWatermark = View(mapContext)
- fakeWatermark.layoutParams = object : RelativeLayout.LayoutParams(0, 0) {
- @SuppressLint("RtlHardcoded")
- override fun addRule(verb: Int, subject: Int) {
- super.addRule(verb, subject)
- val rules = this.rules
- var gravity = 0
- if (rules[RelativeLayout.ALIGN_PARENT_BOTTOM] == RelativeLayout.TRUE) gravity = gravity or Gravity.BOTTOM
- if (rules[RelativeLayout.ALIGN_PARENT_TOP] == RelativeLayout.TRUE) gravity = gravity or Gravity.TOP
- if (rules[RelativeLayout.ALIGN_PARENT_LEFT] == RelativeLayout.TRUE) gravity = gravity or Gravity.LEFT
- if (rules[RelativeLayout.ALIGN_PARENT_RIGHT] == RelativeLayout.TRUE) gravity = gravity or Gravity.RIGHT
- if (rules[RelativeLayout.ALIGN_PARENT_START] == RelativeLayout.TRUE) gravity = gravity or Gravity.START
- if (rules[RelativeLayout.ALIGN_PARENT_END] == RelativeLayout.TRUE) gravity = gravity or Gravity.END
- map?.uiSettings?.logoGravity = gravity
- }
- }
- this.view = object : FrameLayout(mapContext) {
- @Keep
- fun findViewTraversal(@IdRes id: Int): T? {
- return null
- }
-
- @Keep
- fun findViewWithTagTraversal(tag: Any): T? {
- if ("GoogleWatermark" == tag) {
- return try {
- @Suppress("UNCHECKED_CAST")
- fakeWatermark as T
- } catch (e: ClassCastException) {
- null
- }
- }
- return null
- }
- }
- }
-
- override fun getCameraPosition(): CameraPosition? = map?.cameraPosition?.toGms()
- override fun getMaxZoomLevel(): Float = (map?.maxZoomLevel?.toFloat() ?: 20f) + 1f
- override fun getMinZoomLevel(): Float = (map?.minZoomLevel?.toFloat() ?: 0f) + 1f
-
- override fun moveCamera(cameraUpdate: IObjectWrapper?) {
- val update = cameraUpdate.unwrap() ?: return
- synchronized(mapLock) {
- if (initialized) {
- this.map?.moveCamera(update)
- } else {
- waitingCameraUpdates.add(update)
- }
- }
- }
-
- override fun animateCamera(cameraUpdate: IObjectWrapper?) {
- val update = cameraUpdate.unwrap() ?: return
- synchronized(mapLock) {
- if (initialized) {
- this.map?.animateCamera(update)
- } else {
- waitingCameraUpdates.add(update)
- }
- }
- }
-
- fun afterInitialized(runnable: () -> Unit) {
- initializedCallbackList.add(object : IOnMapReadyCallback {
- override fun onMapReady(map: IGoogleMapDelegate?) {
- runnable()
- }
-
- override fun asBinder(): IBinder? = null
- })
- }
-
- override fun animateCameraWithCallback(cameraUpdate: IObjectWrapper?, callback: ICancelableCallback?) {
- val update = cameraUpdate.unwrap() ?: return
- synchronized(mapLock) {
- if (initialized) {
- this.map?.animateCamera(update, callback?.toMapbox())
- } else {
- waitingCameraUpdates.add(update)
- afterInitialized { callback?.onFinish() }
- }
- }
- }
-
- override fun animateCameraWithDurationAndCallback(cameraUpdate: IObjectWrapper?, duration: Int, callback: ICancelableCallback?) {
- val update = cameraUpdate.unwrap() ?: return
- synchronized(mapLock) {
- if (initialized) {
- this.map?.animateCamera(update, duration, callback?.toMapbox())
- } else {
- waitingCameraUpdates.add(update)
- afterInitialized { callback?.onFinish() }
- }
- }
- }
-
- override fun stopAnimation() = map?.cancelTransitions() ?: Unit
-
- override fun setMinZoomPreference(minZoom: Float) {
- map?.setMinZoomPreference(minZoom.toDouble() - 1)
- }
-
- override fun setMaxZoomPreference(maxZoom: Float) {
- map?.setMaxZoomPreference(maxZoom.toDouble() - 1)
- }
-
- override fun resetMinMaxZoomPreference() {
- map?.setMinZoomPreference(MapboxConstants.MINIMUM_ZOOM.toDouble())
- map?.setMaxZoomPreference(MapboxConstants.MAXIMUM_ZOOM.toDouble())
- }
-
- override fun setLatLngBoundsForCameraTarget(bounds: LatLngBounds?) {
- map?.setLatLngBoundsForCameraTarget(bounds?.toMapbox())
- }
-
- override fun addPolyline(options: PolylineOptions): IPolylineDelegate? {
- val line = PolylineImpl(this, "l${lineId++}", options)
- synchronized(this) {
- val lineManager = lineManager
- if (lineManager == null) {
- pendingLines.add(line)
- } else {
- line.update(lineManager)
- }
- }
- return line
- }
-
-
- override fun addPolygon(options: PolygonOptions): IPolygonDelegate? {
- val fill = PolygonImpl(this, "p${fillId++}", options)
- synchronized(this) {
- val fillManager = fillManager
- if (fillManager == null) {
- pendingFills.add(fill)
- } else {
- fill.update(fillManager)
- }
- }
- return fill
- }
-
- override fun addMarker(options: MarkerOptions): IMarkerDelegate? {
- val marker = MarkerImpl(this, "m${markerId++}", options)
- synchronized(this) {
- val symbolManager = symbolManager
- if (symbolManager == null) {
- pendingMarkers.add(marker)
- } else {
- marker.update(symbolManager)
- }
- }
- return marker
- }
-
- override fun addGroundOverlay(options: GroundOverlayOptions): IGroundOverlayDelegate? {
- Log.d(TAG, "unimplemented Method: addGroundOverlay")
- return null
- }
-
- override fun addTileOverlay(options: TileOverlayOptions): ITileOverlayDelegate? {
- Log.d(TAG, "unimplemented Method: addTileOverlay")
- return null
- }
-
- override fun addCircle(options: CircleOptions): ICircleDelegate? {
- val circle = CircleImpl(this, "c${circleId++}", options)
- synchronized(this) {
- val circleManager = circleManager
- if (circleManager == null) {
- pendingCircles.add(circle)
- } else {
- circle.update(circleManager)
- }
- }
- return circle
- }
-
- override fun clear() {
- circleManager?.let { clear(it) }
- lineManager?.let { clear(it) }
- fillManager?.let { clear(it) }
- symbolManager?.let { clear(it) }
- }
-
- fun > clear(manager: AnnotationManager<*, T, *, *, *, *>) {
- val annotations = manager.getAnnotations()
- for (i in 0..annotations.size()) {
- val key = annotations.keyAt(i)
- val value = annotations[key];
- if (value is T) manager.delete(value)
- }
- }
-
- override fun getMapType(): Int {
- return storedMapType
- }
-
- override fun setMapType(type: Int) {
- storedMapType = type
- applyMapType()
- }
-
- fun applyMapType() {
- val circles = circleManager?.annotations?.values()
- val lines = lineManager?.annotations?.values()
- val fills = fillManager?.annotations?.values()
- val symbols = symbolManager?.annotations?.values()
- val update: (Style) -> Unit = {
- circles?.let { runCatching { circleManager?.update(it) } }
- lines?.let { runCatching { lineManager?.update(it) } }
- fills?.let { runCatching { fillManager?.update(it) } }
- symbols?.let { runCatching { symbolManager?.update(it) } }
- }
-
- // TODO: Serve map styles locally
- when (storedMapType) {
- MAP_TYPE_SATELLITE -> map?.setStyle(Style.Builder().fromUrl("mapbox://styles/microg/cjxgloted25ap1ct4uex7m6hi"), update)
- MAP_TYPE_TERRAIN -> map?.setStyle(Style.OUTDOORS, update)
- MAP_TYPE_HYBRID -> map?.setStyle(Style.Builder().fromUrl("mapbox://styles/microg/cjxgloted25ap1ct4uex7m6hi"), update)
- //MAP_TYPE_NONE, MAP_TYPE_NORMAL,
- else -> map?.setStyle(Style.Builder().fromUrl("mapbox://styles/microg/cjui4020201oo1fmca7yuwbor"), update)
- }
-
- map?.let { BitmapDescriptorFactoryImpl.registerMap(it) }
-
- }
-
- override fun setWatermarkEnabled(watermark: Boolean) {
- map?.uiSettings?.isLogoEnabled = watermark
- }
-
- override fun isTrafficEnabled(): Boolean {
- Log.d(TAG, "unimplemented Method: isTrafficEnabled")
- return false
- }
-
- override fun setTrafficEnabled(traffic: Boolean) {
- Log.d(TAG, "unimplemented Method: setTrafficEnabled")
-
- }
-
- override fun isIndoorEnabled(): Boolean {
- Log.d(TAG, "unimplemented Method: isIndoorEnabled")
- return false
- }
-
- override fun setIndoorEnabled(indoor: Boolean) {
- Log.d(TAG, "unimplemented Method: setIndoorEnabled")
-
- }
-
- override fun isMyLocationEnabled(): Boolean {
- Log.d(TAG, "unimplemented Method: isMyLocationEnabled")
- return false
- }
-
- override fun setMyLocationEnabled(myLocation: Boolean) {
- Log.d(TAG, "unimplemented Method: setMyLocationEnabled")
-
- }
-
- override fun getMyLocation(): Location? {
- Log.d(TAG, "unimplemented Method: getMyLocation")
- return null
- }
-
- override fun setLocationSource(locationSource: ILocationSourceDelegate) {
- Log.d(TAG, "unimplemented Method: setLocationSource")
- }
-
- override fun setContentDescription(desc: String?) {
- mapView?.contentDescription = desc
- }
-
- override fun getUiSettings(): IUiSettingsDelegate? = map?.uiSettings?.let { UiSettingsImpl(it) }
-
- override fun getProjection(): IProjectionDelegate? = map?.projection?.let {
- val experiment = try {
- map?.cameraPosition?.tilt == 0.0 && map?.cameraPosition?.bearing == 0.0
- } catch (e: Exception) {
- Log.w(TAG, e); false
- }
- ProjectionImpl(it, experiment)
- }
-
- override fun setOnCameraChangeListener(listener: IOnCameraChangeListener?) {
- cameraChangeListener = listener
- }
-
- override fun setOnMapClickListener(listener: IOnMapClickListener?) {
- mapClickListener = listener
- }
-
- override fun setOnMapLongClickListener(listener: IOnMapLongClickListener?) {
- mapLongClickListener = listener
- }
-
- override fun setOnMarkerClickListener(listener: IOnMarkerClickListener?) {
- markerClickListener = listener
- }
-
- override fun setOnMarkerDragListener(listener: IOnMarkerDragListener?) {
- markerDragListener = listener
- }
-
- override fun setOnInfoWindowClickListener(listener: IOnInfoWindowClickListener?) {
- Log.d(TAG, "unimplemented Method: setOnInfoWindowClickListener")
-
- }
-
- override fun setInfoWindowAdapter(adapter: IInfoWindowAdapter?) {
- Log.d(TAG, "unimplemented Method: setInfoWindowAdapter")
-
- }
-
- override fun getTestingHelper(): IObjectWrapper? {
- Log.d(TAG, "unimplemented Method: getTestingHelper")
- return null
- }
-
- override fun setOnMyLocationChangeListener(listener: IOnMyLocationChangeListener?) {
- Log.d(TAG, "unimplemented Method: setOnMyLocationChangeListener")
-
- }
-
- override fun setOnMyLocationButtonClickListener(listener: IOnMyLocationButtonClickListener?) {
- Log.d(TAG, "unimplemented Method: setOnMyLocationButtonClickListener")
-
- }
-
- override fun snapshot(callback: ISnapshotReadyCallback, bitmap: IObjectWrapper) {
- Log.d(TAG, "unimplemented Method: snapshot")
-
- }
-
- override fun setPadding(left: Int, top: Int, right: Int, bottom: Int) {
- Log.d(TAG, "setPadding: $left $top $right $bottom")
- map?.let { map ->
- map.setPadding(left, top, right, bottom)
- val fourDp = mapView?.context?.resources?.getDimension(R.dimen.mapbox_four_dp)?.toInt()
- ?: 0
- val ninetyTwoDp = mapView?.context?.resources?.getDimension(R.dimen.mapbox_ninety_two_dp)?.toInt()
- ?: 0
- map.uiSettings.setLogoMargins(left + fourDp, top + fourDp, right + fourDp, bottom + fourDp)
- map.uiSettings.setCompassMargins(left + fourDp, top + fourDp, right + fourDp, bottom + fourDp)
- map.uiSettings.setAttributionMargins(left + ninetyTwoDp, top + fourDp, right + fourDp, bottom + fourDp)
- }
- }
-
- override fun isBuildingsEnabled(): Boolean {
- Log.d(TAG, "unimplemented Method: isBuildingsEnabled")
- return false
- }
-
- override fun setBuildingsEnabled(buildings: Boolean) {
- Log.d(TAG, "unimplemented Method: setBuildingsEnabled")
-
- }
-
- override fun setOnMapLoadedCallback(callback: IOnMapLoadedCallback?) {
- if (callback != null) {
- synchronized(mapLock) {
- if (loaded) {
- Log.d(TAG, "Invoking callback instantly, as map is loaded")
- try {
- callback.onMapLoaded()
- } catch (e: Exception) {
- Log.w(TAG, e)
- }
- } else {
- Log.d(TAG, "Delay callback invocation, as map is not yet loaded")
- loadedCallback = callback
- }
- }
- } else {
- loadedCallback = null
- }
- }
-
- override fun setCameraMoveStartedListener(listener: IOnCameraMoveStartedListener?) {
- cameraMoveStartedListener = listener
- }
-
- override fun setCameraMoveListener(listener: IOnCameraMoveListener?) {
- cameraMoveListener = listener
- }
-
- override fun setCameraMoveCanceledListener(listener: IOnCameraMoveCanceledListener?) {
- cameraMoveCanceledListener = listener
- }
-
- override fun setCameraIdleListener(listener: IOnCameraIdleListener?) {
- cameraIdleListener = listener
- }
-
- override fun onCreate(savedInstanceState: Bundle?) {
- if (!created) {
- Log.d(TAG, "create");
- val mapView = MapView(MapContext(context))
- this.mapView = mapView
- view.addView(mapView)
- mapView.onCreate(savedInstanceState?.toMapbox())
- mapView.getMapAsync(this::initMap)
- created = true
- }
- }
-
- private fun hasSymbolAt(latlng: com.mapbox.mapboxsdk.geometry.LatLng): Boolean {
- val point = map?.projection?.toScreenLocation(latlng) ?: return false
- val features = map?.queryRenderedFeatures(point, symbolManager?.layerId)
- ?: return false
- return features.isNotEmpty()
- }
-
- private fun initMap(map: MapboxMap) {
- if (this.map != null) return
- this.map = map
-
- map.addOnCameraIdleListener {
- try {
- cameraChangeListener?.onCameraChange(map.cameraPosition.toGms())
- } catch (e: Exception) {
- Log.w(TAG, e)
- }
- }
- map.addOnCameraIdleListener {
- try {
- cameraIdleListener?.onCameraIdle()
- } catch (e: Exception) {
- Log.w(TAG, e)
- }
- }
- map.addOnCameraMoveListener {
- try {
- cameraMoveListener?.onCameraMove()
- } catch (e: Exception) {
- Log.w(TAG, e)
- }
- }
- map.addOnCameraMoveStartedListener {
- try {
- cameraMoveStartedListener?.onCameraMoveStarted(it)
- } catch (e: Exception) {
- Log.w(TAG, e)
- }
- }
- map.addOnCameraMoveCancelListener {
- try {
- cameraMoveCanceledListener?.onCameraMoveCanceled()
- } catch (e: Exception) {
- Log.w(TAG, e)
- }
- }
- map.addOnMapClickListener { latlng ->
- try {
- mapClickListener?.let { if (!hasSymbolAt(latlng)) it.onMapClick(latlng.toGms()); }
- } catch (e: Exception) {
- Log.w(TAG, e)
- }
- false
- }
- map.addOnMapLongClickListener { latlng ->
- try {
- mapLongClickListener?.let { if (!hasSymbolAt(latlng)) it.onMapLongClick(latlng.toGms()); }
- } catch (e: Exception) {
- Log.w(TAG, e)
- }
- false
- }
-
- applyMapType()
- options.minZoomPreference?.let { if (it != 0f) map.setMinZoomPreference(it.toDouble()) }
- options.maxZoomPreference?.let { if (it != 0f) map.setMaxZoomPreference(it.toDouble()) }
- options.latLngBoundsForCameraTarget?.let { map.setLatLngBoundsForCameraTarget(it.toMapbox()) }
- options.compassEnabled?.let { map.uiSettings.isCompassEnabled = it }
- options.rotateGesturesEnabled?.let { map.uiSettings.isRotateGesturesEnabled = it }
- options.scrollGesturesEnabled?.let { map.uiSettings.isScrollGesturesEnabled = it }
- options.tiltGesturesEnabled?.let { map.uiSettings.isTiltGesturesEnabled = it }
- options.camera?.let { map.cameraPosition = it.toMapbox() }
-
- synchronized(mapLock) {
- initialized = true
- waitingCameraUpdates.forEach { map.moveCamera(it) }
- val initializedCallbackList = ArrayList(initializedCallbackList)
- Log.d(TAG, "Invoking ${initializedCallbackList.size} callbacks delayed, as map is initialized")
- for (callback in initializedCallbackList) {
- try {
- callback.onMapReady(this)
- } catch (e: Exception) {
- Log.w(TAG, e)
- }
- }
- }
-
- map.getStyle {
- mapView?.let { view ->
- if (loaded) return@let
- val symbolManager: SymbolManager
- val lineManager: LineManager
- val circleManager: CircleManager
- val fillManager: FillManager
-
- synchronized(mapLock) {
- circleManager = CircleManager(view, map, it)
- fillManager = FillManager(view, map, it)
- symbolManager = SymbolManager(view, map, it)
- lineManager = LineManager(view, map, it)
- lineManager.lineCap = LINE_CAP_ROUND
-
- this.symbolManager = symbolManager
- this.lineManager = lineManager
- this.circleManager = circleManager
- this.fillManager = fillManager
- }
- symbolManager.iconAllowOverlap = true
- symbolManager.addClickListener {
- try {
- markers[it.id]?.let { markerClickListener?.onMarkerClick(it) }
- } catch (e: Exception) {
- Log.w(TAG, e)
- }
- }
- symbolManager.addDragListener(object : OnSymbolDragListener {
- override fun onAnnotationDragStarted(annotation: Symbol?) {
- try {
- markers[annotation?.id]?.let { markerDragListener?.onMarkerDragStart(it) }
- } catch (e: Exception) {
- Log.w(TAG, e)
- }
- }
-
- override fun onAnnotationDrag(annotation: Symbol?) {
- try {
- markers[annotation?.id]?.let { markerDragListener?.onMarkerDrag(it) }
- } catch (e: Exception) {
- Log.w(TAG, e)
- }
- }
-
- override fun onAnnotationDragFinished(annotation: Symbol?) {
- try {
- markers[annotation?.id]?.let { markerDragListener?.onMarkerDragEnd(it) }
- } catch (e: Exception) {
- Log.w(TAG, e)
- }
- }
- })
- pendingCircles.forEach { it.update(circleManager) }
- pendingCircles.clear()
- pendingFills.forEach { it.update(fillManager) }
- pendingFills.clear()
- pendingLines.forEach { it.update(lineManager) }
- pendingLines.clear()
- pendingMarkers.forEach { it.update(symbolManager) }
- pendingMarkers.clear()
-
- synchronized(mapLock) {
- loaded = true
- if (loadedCallback != null) {
- Log.d(TAG, "Invoking callback delayed, as map is loaded")
- loadedCallback?.onMapLoaded()
- }
- }
- }
- }
- }
-
- override fun useViewLifecycleWhenInFragment(): Boolean {
- Log.d(TAG, "unimplemented Method: useViewLifecycleWhenInFragment")
- return false
- }
-
- override fun onResume() = mapView?.onResume() ?: Unit
- override fun onPause() = mapView?.onPause() ?: Unit
- override fun onDestroy() {
- Log.d(TAG, "destroy");
- circleManager?.onDestroy()
- circleManager = null
- lineManager?.onDestroy()
- lineManager = null
- fillManager?.onDestroy()
- fillManager = null
- symbolManager?.onDestroy()
- symbolManager = null
- pendingMarkers.clear()
- markers.clear()
- BitmapDescriptorFactoryImpl.unregisterMap(map)
- view.removeView(mapView)
- // TODO can crash?
- mapView?.onDestroy()
- mapView = null
- map = null
- created = false
- initialized = false
- loaded = false
- }
-
- override fun onStart() {
- mapView?.onStart()
- }
-
- override fun onStop() {
- mapView?.onStop()
- }
-
- override fun onEnterAmbient(bundle: Bundle?) {
- Log.d(TAG, "unimplemented Method: onEnterAmbient")
- }
-
- override fun onExitAmbient() {
- Log.d(TAG, "unimplemented Method: onExitAmbient")
- }
-
- override fun onLowMemory() = mapView?.onLowMemory() ?: Unit
- override fun onSaveInstanceState(outState: Bundle) {
- val newBundle = Bundle()
- mapView?.onSaveInstanceState(newBundle)
- outState.putAll(newBundle.toGms())
- }
-
- fun getMapAsync(callback: IOnMapReadyCallback) {
- synchronized(mapLock) {
- if (initialized) {
- Log.d(TAG, "Invoking callback instantly, as map is initialized")
- try {
- callback.onMapReady(this)
- } catch (e: Exception) {
- Log.w(TAG, e)
- }
- } else {
- Log.d(TAG, "Delay callback invocation, as map is not yet initialized")
- initializedCallbackList.add(callback)
- }
- }
- }
-
- override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean =
- if (super.onTransact(code, data, reply, flags)) {
- true
- } else {
- Log.d(TAG, "onTransact [unknown]: $code, $data, $flags"); false
- }
-
- companion object {
- private val TAG = "GmsMap"
- }
-}
diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/MapFragment.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/MapFragment.kt
deleted file mode 100644
index daf4bfb9..00000000
--- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/MapFragment.kt
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.mapbox
-
-import android.app.Activity
-import android.os.Bundle
-import android.os.Parcel
-import android.util.Base64
-import android.util.Log
-import android.view.View
-import android.view.ViewGroup
-import com.google.android.gms.dynamic.IObjectWrapper
-import com.google.android.gms.dynamic.ObjectWrapper
-import com.google.android.gms.maps.GoogleMapOptions
-import com.google.android.gms.maps.internal.IGoogleMapDelegate
-import com.google.android.gms.maps.internal.IMapFragmentDelegate
-import com.google.android.gms.maps.internal.IOnMapReadyCallback
-
-class MapFragmentImpl(private val activity: Activity) : IMapFragmentDelegate.Stub() {
-
- private var map: GoogleMapImpl? = null
- private var options: GoogleMapOptions? = null
-
- override fun onInflate(activity: IObjectWrapper, options: GoogleMapOptions, savedInstanceState: Bundle?) {
- this.options = options
- map?.options = options
- }
-
- override fun onCreate(savedInstanceState: Bundle?) {
- if (options == null) {
- options = savedInstanceState?.getParcelable("MapOptions")
- }
- if (options == null) {
- options = GoogleMapOptions()
- }
- map = GoogleMapImpl(activity, options ?: GoogleMapOptions())
- }
-
- override fun onCreateView(layoutInflater: IObjectWrapper, container: IObjectWrapper, savedInstanceState: Bundle?): IObjectWrapper {
- if (options == null) {
- options = savedInstanceState?.getParcelable("MapOptions")
- }
- Log.d(TAG, "onCreateView: ${options?.camera?.target}")
- if (map == null) {
- map = GoogleMapImpl(activity, options ?: GoogleMapOptions())
- }
- map!!.onCreate(savedInstanceState)
- val view = map!!.view
- val parent = view.parent as ViewGroup?
- parent?.removeView(view)
- return ObjectWrapper.wrap(view)
- }
-
- override fun getMap(): IGoogleMapDelegate? = map
- override fun onEnterAmbient(bundle: Bundle?) = map?.onEnterAmbient(bundle) ?: Unit
- override fun onExitAmbient() = map?.onExitAmbient() ?: Unit
- override fun onStart() = map?.onStart() ?: Unit
- override fun onStop() = map?.onStop() ?: Unit
- override fun onResume() = map?.onResume() ?: Unit
- override fun onPause() = map?.onPause() ?: Unit
- override fun onLowMemory() = map?.onLowMemory() ?: Unit
- override fun isReady(): Boolean = this.map != null
- override fun getMapAsync(callback: IOnMapReadyCallback) = map?.getMapAsync(callback) ?: Unit
-
- override fun onDestroyView() {
- map?.onDestroy()
- }
-
- override fun onDestroy() {
- map?.onDestroy()
- map = null
- options = null
- }
-
- override fun onSaveInstanceState(outState: Bundle) {
- if (options != null) {
- outState.putParcelable("MapOptions", options)
- }
- map?.onSaveInstanceState(outState)
- }
-
- override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean {
- if (super.onTransact(code, data, reply, flags)) {
- return true
- } else {
- Log.d(TAG, "onTransact [unknown]: $code, $data, $flags")
- return false
- }
- }
-
- companion object {
- private val TAG = "GmsMapFragment"
- }
-}
diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/MapView.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/MapView.kt
deleted file mode 100644
index 8951aaf1..00000000
--- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/MapView.kt
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.mapbox
-
-import android.content.Context
-import android.os.Bundle
-import android.os.Parcel
-import android.util.Log
-import com.google.android.gms.dynamic.IObjectWrapper
-import com.google.android.gms.dynamic.ObjectWrapper
-import com.google.android.gms.maps.GoogleMapOptions
-import com.google.android.gms.maps.internal.IGoogleMapDelegate
-import com.google.android.gms.maps.internal.IMapViewDelegate
-import com.google.android.gms.maps.internal.IOnMapReadyCallback
-
-class MapViewImpl(private val context: Context, options: GoogleMapOptions?) : IMapViewDelegate.Stub() {
-
- private val options: GoogleMapOptions = options ?: GoogleMapOptions()
- private var map: GoogleMapImpl? = null
-
- override fun onCreate(savedInstanceState: Bundle?) {
- Log.d(TAG, "onCreate: ${options?.camera?.target}")
- map = GoogleMapImpl(context, options)
- map!!.onCreate(savedInstanceState)
- }
-
- override fun getMap(): IGoogleMapDelegate? = map
- override fun onEnterAmbient(bundle: Bundle?) = map?.onEnterAmbient(bundle) ?: Unit
- override fun onExitAmbient() = map?.onExitAmbient() ?: Unit
- override fun onStart() = map?.onStart() ?: Unit
- override fun onStop() = map?.onStop() ?: Unit
- override fun onResume() = map?.onResume() ?: Unit
- override fun onPause() = map?.onPause() ?: Unit
- override fun onDestroy() {
- map?.onDestroy()
- map = null
- }
-
- override fun onLowMemory() = map?.onLowMemory() ?: Unit
- override fun onSaveInstanceState(outState: Bundle) = map?.onSaveInstanceState(outState) ?: Unit
- override fun getView(): IObjectWrapper = ObjectWrapper.wrap(map?.view)
- override fun getMapAsync(callback: IOnMapReadyCallback) = map?.getMapAsync(callback) ?: Unit
-
- override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean =
- if (super.onTransact(code, data, reply, flags)) {
- true
- } else {
- Log.d(TAG, "onTransact [unknown]: $code, $data, $flags"); false
- }
-
- companion object {
- private val TAG = "GmsMapView"
- }
-}
diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/Projection.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/Projection.kt
deleted file mode 100644
index c36e57ed..00000000
--- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/Projection.kt
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.mapbox
-
-import android.graphics.Point
-import android.graphics.PointF
-import android.util.Log
-import com.google.android.gms.dynamic.IObjectWrapper
-import com.google.android.gms.dynamic.ObjectWrapper
-import com.google.android.gms.maps.internal.IProjectionDelegate
-import com.google.android.gms.maps.model.LatLng
-import com.google.android.gms.maps.model.VisibleRegion
-import com.mapbox.mapboxsdk.maps.Projection
-import org.microg.gms.kotlin.unwrap
-import org.microg.gms.maps.mapbox.utils.toGms
-import org.microg.gms.maps.mapbox.utils.toMapbox
-import kotlin.math.roundToInt
-
-// TODO: Do calculations using backed up locations instead of live (which requires UI thread)
-class ProjectionImpl(private val projection: Projection, private val withoutTiltOrBearing: Boolean) : IProjectionDelegate.Stub() {
- private val visibleRegion = projection.visibleRegion
- private val farLeft = projection.toScreenLocation(visibleRegion.farLeft)
- private val farRight = projection.toScreenLocation(visibleRegion.farRight)
- private val nearLeft = projection.toScreenLocation(visibleRegion.nearLeft)
- private val nearRight = projection.toScreenLocation(visibleRegion.nearRight)
-
- override fun fromScreenLocation(obj: IObjectWrapper?): LatLng? = try {
- obj.unwrap()?.let {
- if (withoutTiltOrBearing) {
- val xPercent = (it.x.toFloat() - farLeft.x) / (farRight.x - farLeft.x)
- val yPercent = (it.y.toFloat() - farLeft.y) / (nearLeft.y - farLeft.y)
- val lon = visibleRegion.farLeft.longitude + xPercent * (visibleRegion.farRight.longitude - visibleRegion.farLeft.longitude)
- val lat = visibleRegion.farLeft.latitude + yPercent * (visibleRegion.nearLeft.latitude - visibleRegion.farLeft.latitude)
- LatLng(lat, lon)
- } else {
- projection.fromScreenLocation(PointF(it)).toGms()
- }
- }
- } catch (e: Exception) {
- Log.d(TAG, "fromScreenLocation() used from outside UI thread on map with tilt or bearing, expect bugs")
- LatLng(0.0, 0.0)
- }
-
- override fun toScreenLocation(latLng: LatLng?): IObjectWrapper = try {
- ObjectWrapper.wrap(latLng?.toMapbox()?.let {
- if (withoutTiltOrBearing) {
- val xPercent = (it.longitude - visibleRegion.farLeft.longitude) / (visibleRegion.farRight.longitude - visibleRegion.farLeft.longitude)
- val yPercent = (it.latitude - visibleRegion.farLeft.latitude) / (visibleRegion.nearLeft.latitude - visibleRegion.farLeft.latitude)
- val x = farLeft.x + xPercent * (farRight.x - farLeft.x)
- val y = farLeft.y + yPercent * (nearLeft.y - farLeft.y)
- Point(x.roundToInt(), y.roundToInt())
- } else {
- projection.toScreenLocation(it).let { Point(it.x.roundToInt(), it.y.roundToInt()) }
- }
- })
- } catch (e: Exception) {
- Log.d(TAG, "toScreenLocation() used from outside UI thread on map with tilt or bearing, expect bugs")
- ObjectWrapper.wrap(Point(0, 0))
- }
-
- override fun getVisibleRegion(): VisibleRegion = visibleRegion.toGms()
-
- companion object {
- private val TAG = "GmsMapProjection"
- }
-}
\ No newline at end of file
diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/UiSettings.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/UiSettings.kt
deleted file mode 100644
index 32320eb4..00000000
--- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/UiSettings.kt
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.mapbox
-
-import android.os.Parcel
-import android.os.RemoteException
-import android.util.Log
-
-import com.google.android.gms.maps.internal.IUiSettingsDelegate
-import com.mapbox.mapboxsdk.maps.UiSettings
-
-class UiSettingsImpl(private val uiSettings: UiSettings) : IUiSettingsDelegate.Stub() {
-
- override fun setZoomControlsEnabled(zoom: Boolean) {
- Log.d(TAG, "unimplemented Method: setZoomControlsEnabled")
- }
-
- override fun setCompassEnabled(compass: Boolean) {
- uiSettings.isCompassEnabled = compass
- }
-
- override fun setMyLocationButtonEnabled(locationButton: Boolean) {
- Log.d(TAG, "unimplemented Method: setMyLocationButtonEnabled")
-
- }
-
- override fun setScrollGesturesEnabled(scrollGestures: Boolean) {
- uiSettings.isScrollGesturesEnabled = scrollGestures
- }
-
- override fun setZoomGesturesEnabled(zoomGestures: Boolean) {
- uiSettings.isZoomGesturesEnabled = zoomGestures
- }
-
- override fun setTiltGesturesEnabled(tiltGestures: Boolean) {
- uiSettings.isTiltGesturesEnabled = tiltGestures
- }
-
- override fun setRotateGesturesEnabled(rotateGestures: Boolean) {
- uiSettings.isRotateGesturesEnabled = rotateGestures
- }
-
- override fun setAllGesturesEnabled(gestures: Boolean) {
- uiSettings.setAllGesturesEnabled(gestures)
- }
-
- override fun isZoomControlsEnabled(): Boolean {
- Log.d(TAG, "unimplemented Method: isZoomControlsEnabled")
- return false
- }
-
- override fun isCompassEnabled(): Boolean = uiSettings.isCompassEnabled
-
- override fun isMyLocationButtonEnabled(): Boolean {
- Log.d(TAG, "unimplemented Method: isMyLocationButtonEnabled")
- return false
- }
-
- override fun isScrollGesturesEnabled(): Boolean = uiSettings.isScrollGesturesEnabled
-
- override fun isZoomGesturesEnabled(): Boolean = uiSettings.isZoomGesturesEnabled
-
- override fun isTiltGesturesEnabled(): Boolean = uiSettings.isTiltGesturesEnabled
-
- override fun isRotateGesturesEnabled(): Boolean = uiSettings.isRotateGesturesEnabled
-
- override fun setIndoorLevelPickerEnabled(indoorLevelPicker: Boolean) {
- Log.d(TAG, "unimplemented Method: setIndoorLevelPickerEnabled")
- }
-
- override fun isIndoorLevelPickerEnabled(): Boolean {
- Log.d(TAG, "unimplemented Method: isIndoorLevelPickerEnabled")
- return false
- }
-
- override fun setMapToolbarEnabled(mapToolbar: Boolean) {
- Log.d(TAG, "unimplemented Method: setMapToolbarEnabled")
- }
-
- override fun isMapToolbarEnabled(): Boolean {
- Log.d(TAG, "unimplemented Method: isMapToolbarEnabled")
- return false
- }
-
- override fun setScrollGesturesEnabledDuringRotateOrZoom(scrollDuringZoom: Boolean) {
- Log.d(TAG, "unimplemented Method: setScrollGesturesEnabledDuringRotateOrZoom")
- }
-
- override fun isScrollGesturesEnabledDuringRotateOrZoom(): Boolean {
- Log.d(TAG, "unimplemented Method: isScrollGesturesEnabledDuringRotateOrZoom")
- return true
- }
-
- override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean =
- if (super.onTransact(code, data, reply, flags)) {
- true
- } else {
- Log.d(TAG, "onTransact [unknown]: $code, $data, $flags"); false
- }
-
- companion object {
- private val TAG = "GmsMapsUi"
- }
-}
diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/BitmapDescriptor.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/BitmapDescriptor.kt
deleted file mode 100644
index e228387d..00000000
--- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/BitmapDescriptor.kt
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.mapbox.model
-
-import android.graphics.Color
-import android.graphics.PointF
-import android.util.Log
-import com.mapbox.mapboxsdk.plugins.annotation.Symbol
-import com.mapbox.mapboxsdk.plugins.annotation.SymbolOptions
-import com.mapbox.mapboxsdk.style.layers.Property.ICON_ANCHOR_TOP_LEFT
-import com.mapbox.mapboxsdk.utils.ColorUtils
-
-open class BitmapDescriptorImpl(private val id: String, private val size: FloatArray) {
- open fun applyTo(options: SymbolOptions, anchor: FloatArray, dpiFactor: Float): SymbolOptions {
- return options.withIconImage(id).withIconAnchor(ICON_ANCHOR_TOP_LEFT).withIconOffset(arrayOf(-anchor[0] * size[0] / dpiFactor, -anchor[1] * size[1] / dpiFactor))
- }
-
- open fun applyTo(symbol: Symbol, anchor: FloatArray, dpiFactor: Float) {
- symbol.iconAnchor = ICON_ANCHOR_TOP_LEFT
- symbol.iconOffset = PointF(-anchor[0] * size[0] / dpiFactor, -anchor[1] * size[1] / dpiFactor)
- symbol.iconImage = id
- }
-}
-
-class ColorBitmapDescriptorImpl(id: String, size: FloatArray, val hue: Float) : BitmapDescriptorImpl(id, size) {
- override fun applyTo(options: SymbolOptions, anchor: FloatArray, dpiFactor: Float): SymbolOptions = super.applyTo(options, anchor, dpiFactor).withIconColor(ColorUtils.colorToRgbaString(Color.HSVToColor(floatArrayOf(hue, 1.0f, 0.5f))))
- override fun applyTo(symbol: Symbol, anchor: FloatArray, dpiFactor: Float) {
- super.applyTo(symbol, anchor, dpiFactor)
- symbol.setIconColor(Color.HSVToColor(floatArrayOf(hue, 1.0f, 0.5f)))
- }
-}
\ No newline at end of file
diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/BitmapDescriptorFactory.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/BitmapDescriptorFactory.kt
deleted file mode 100644
index f4f51748..00000000
--- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/BitmapDescriptorFactory.kt
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.mapbox.model
-
-import android.content.res.Resources
-import android.graphics.*
-import android.os.Handler
-import android.os.Looper
-import android.os.Parcel
-import android.util.Log
-import com.google.android.gms.dynamic.IObjectWrapper
-import com.google.android.gms.dynamic.ObjectWrapper
-import com.google.android.gms.maps.model.internal.IBitmapDescriptorFactoryDelegate
-import com.mapbox.mapboxsdk.maps.MapboxMap
-import org.microg.gms.maps.mapbox.R
-import org.microg.gms.maps.mapbox.runOnMainLooper
-
-
-object BitmapDescriptorFactoryImpl : IBitmapDescriptorFactoryDelegate.Stub() {
- private val TAG = "GmsMapBitmap"
- private var resources: Resources? = null
- private var mapResources: Resources? = null
- private val maps = hashSetOf()
- private val bitmaps = hashMapOf()
-
- fun initialize(mapResources: Resources?, resources: Resources?) {
- BitmapDescriptorFactoryImpl.mapResources = mapResources ?: resources
- BitmapDescriptorFactoryImpl.resources = resources ?: mapResources
- }
-
- fun registerMap(map: MapboxMap) {
- Log.d(TAG, "registerMap")
- map.getStyle {
- synchronized(bitmaps) {
- it.addImages(bitmaps)
- }
- }
- maps.add(map)
- }
-
- fun unregisterMap(map: MapboxMap?) {
- maps.remove(map)
- // TODO: cleanup bitmaps?
- }
-
- fun bitmapSize(id: String): FloatArray =
- bitmaps[id]?.let { floatArrayOf(it.width.toFloat(), it.height.toFloat()) }
- ?: floatArrayOf(0f, 0f)
-
- private fun registerBitmap(id: String, bitmapCreator: () -> Bitmap?) {
- val bitmap: Bitmap = synchronized(bitmaps) {
- if (bitmaps.contains(id)) return
- val bitmap = bitmapCreator()
- if (bitmap == null) {
- Log.w(TAG, "Failed to register bitmap $id, creator returned null")
- return
- }
- bitmaps[id] = bitmap
- bitmap
- }
- for (map in maps) {
- map.getStyle {
- runOnMainLooper {
- it.addImage(id, bitmap)
- }
- }
- }
- }
-
- override fun fromResource(resourceId: Int): IObjectWrapper? {
- val id = "resource-$resourceId"
- registerBitmap(id) {
- val bitmap = BitmapFactory.decodeResource(resources, resourceId)
- if (bitmap == null) {
- try {
- Log.d(TAG, "Resource $resourceId not found in $resources (${resources?.getResourceName(resourceId)})")
- } catch (e: Resources.NotFoundException) {
- Log.d(TAG, "Resource $resourceId not found in $resources")
- }
- }
- bitmap
- }
- return ObjectWrapper.wrap(BitmapDescriptorImpl(id, bitmapSize(id)))
- }
-
- override fun fromAsset(assetName: String): IObjectWrapper? {
- val id = "asset-$assetName"
- registerBitmap(id) { resources?.assets?.open(assetName)?.let { BitmapFactory.decodeStream(it) } }
- return ObjectWrapper.wrap(BitmapDescriptorImpl(id, bitmapSize(id)))
- }
-
- override fun fromFile(fileName: String): IObjectWrapper? {
- val id = "file-$fileName"
- registerBitmap(id) { BitmapFactory.decodeFile(fileName) }
- return ObjectWrapper.wrap(BitmapDescriptorImpl(id, bitmapSize(id)))
- }
-
- override fun defaultMarker(): IObjectWrapper? {
- val id = "marker"
- registerBitmap(id) { BitmapFactory.decodeResource(mapResources, R.drawable.maps_default_marker) }
- return ObjectWrapper.wrap(BitmapDescriptorImpl(id, bitmapSize(id)))
- }
-
- private fun adjustHue(cm: ColorMatrix, value: Float) {
- var value = value
- value = cleanValue(value, 180f) / 180f * Math.PI.toFloat()
- if (value == 0f) {
- return
- }
- val cosVal = Math.cos(value.toDouble()).toFloat()
- val sinVal = Math.sin(value.toDouble()).toFloat()
- val lumR = 0.213f
- val lumG = 0.715f
- val lumB = 0.072f
- val mat = floatArrayOf(lumR + cosVal * (1 - lumR) + sinVal * -lumR, lumG + cosVal * -lumG + sinVal * -lumG, lumB + cosVal * -lumB + sinVal * (1 - lumB), 0f, 0f, lumR + cosVal * -lumR + sinVal * 0.143f, lumG + cosVal * (1 - lumG) + sinVal * 0.140f, lumB + cosVal * -lumB + sinVal * -0.283f, 0f, 0f, lumR + cosVal * -lumR + sinVal * -(1 - lumR), lumG + cosVal * -lumG + sinVal * lumG, lumB + cosVal * (1 - lumB) + sinVal * lumB, 0f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 0f, 1f)
- cm.postConcat(ColorMatrix(mat))
- }
-
- private fun cleanValue(p_val: Float, p_limit: Float): Float {
- return Math.min(p_limit, Math.max(-p_limit, p_val))
- }
-
- override fun defaultMarkerWithHue(hue: Float): IObjectWrapper? {
- val id = "marker-${hue.toInt()}"
- registerBitmap(id) {
- val bitmap = BitmapFactory.decodeResource(mapResources, R.drawable.maps_default_marker).copy(Bitmap.Config.ARGB_8888, true)
- val paint = Paint()
- val matrix = ColorMatrix()
- val huex = hue % 360f
- adjustHue(matrix, if (huex > 180f) huex - 360f else huex)
- paint.setColorFilter(ColorMatrixColorFilter(matrix))
-
- val canvas = Canvas(bitmap)
- canvas.drawBitmap(bitmap, 0f, 0f, paint)
- bitmap
- }
- return ObjectWrapper.wrap(ColorBitmapDescriptorImpl(id, bitmapSize(id), hue))
- }
-
- override fun fromBitmap(bitmap: Bitmap): IObjectWrapper? {
- val id = "bitmap-${bitmap.hashCode()}"
- registerBitmap(id) { bitmap }
- return ObjectWrapper.wrap(BitmapDescriptorImpl(id, bitmapSize(id)))
- }
-
- override fun fromPath(absolutePath: String): IObjectWrapper? {
- val id = "path-$absolutePath"
- registerBitmap(id) { BitmapFactory.decodeFile(absolutePath) }
- return ObjectWrapper.wrap(BitmapDescriptorImpl(id, bitmapSize(id)))
- }
-
- override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean =
- if (super.onTransact(code, data, reply, flags)) {
- true
- } else {
- Log.d(TAG, "onTransact [unknown]: $code, $data, $flags"); false
- }
-}
diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Circle.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Circle.kt
deleted file mode 100644
index aa016ea8..00000000
--- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Circle.kt
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.mapbox.model
-
-import android.os.Parcel
-import android.util.Log
-import com.google.android.gms.maps.model.LatLng
-import com.google.android.gms.maps.model.internal.ICircleDelegate
-import com.mapbox.mapboxsdk.plugins.annotation.Circle
-import com.mapbox.mapboxsdk.plugins.annotation.CircleOptions
-import com.mapbox.mapboxsdk.utils.ColorUtils
-import org.microg.gms.maps.mapbox.GoogleMapImpl
-import org.microg.gms.maps.mapbox.utils.toMapbox
-import com.google.android.gms.maps.model.CircleOptions as GmsCircleOptions
-
-class CircleImpl(private val map: GoogleMapImpl, private val id: String, options: GmsCircleOptions) : ICircleDelegate.Stub(), Markup {
- private var center: LatLng = options.center
- private var radius: Double = options.radius
- private var strokeWidth: Float = options.strokeWidth
- private var strokeColor: Int = options.strokeColor
- private var fillColor: Int = options.fillColor
- private var visible: Boolean = options.isVisible
-
- override var annotation: Circle? = null
- override var removed: Boolean = false
- override val annotationOptions: CircleOptions
- get() = CircleOptions()
- .withLatLng(center.toMapbox())
- .withCircleColor(ColorUtils.colorToRgbaString(fillColor))
- .withCircleRadius(radius.toFloat())
- .withCircleStrokeColor(ColorUtils.colorToRgbaString(strokeColor))
- .withCircleStrokeWidth(strokeWidth / map.dpiFactor)
- .withCircleOpacity(if (visible) 1f else 0f)
- .withCircleStrokeOpacity(if (visible) 1f else 0f)
-
- override fun remove() {
- removed = true
- map.circleManager?.let { update(it) }
- }
-
- override fun getId(): String = id
-
- override fun setCenter(center: LatLng) {
- this.center = center
- annotation?.latLng = center.toMapbox()
- map.circleManager?.let { update(it) }
- }
-
- override fun getCenter(): LatLng = center
-
- override fun setRadius(radius: Double) {
- this.radius = radius
- annotation?.circleRadius = radius.toFloat()
- map.circleManager?.let { update(it) }
- }
-
- override fun getRadius(): Double = radius
-
- override fun setStrokeWidth(width: Float) {
- this.strokeWidth = width
- annotation?.circleStrokeWidth = width / map.dpiFactor
- map.circleManager?.let { update(it) }
- }
-
- override fun getStrokeWidth(): Float = strokeWidth
-
- override fun setStrokeColor(color: Int) {
- this.strokeColor = color
- annotation?.setCircleStrokeColor(color)
- map.circleManager?.let { update(it) }
- }
-
- override fun getStrokeColor(): Int = strokeColor
-
- override fun setFillColor(color: Int) {
- this.fillColor = color
- annotation?.setCircleColor(color)
- map.circleManager?.let { update(it) }
- }
-
- override fun getFillColor(): Int = fillColor
-
- override fun setZIndex(zIndex: Float) {
- Log.d(TAG, "unimplemented Method: setZIndex")
- }
-
- override fun getZIndex(): Float {
- Log.d(TAG, "unimplemented Method: getZIndex")
- return 0f
- }
-
- override fun setVisible(visible: Boolean) {
- this.visible = visible
- annotation?.circleOpacity = if (visible) 1f else 0f
- annotation?.circleStrokeOpacity = if (visible) 1f else 0f
- map.circleManager?.let { update(it) }
- }
-
- override fun isVisible(): Boolean = visible
-
- override fun equalsRemote(other: ICircleDelegate?): Boolean = equals(other)
-
- override fun hashCodeRemote(): Int = hashCode()
-
- override fun hashCode(): Int {
- return id.hashCode()
- }
-
- override fun toString(): String {
- return id
- }
-
- override fun equals(other: Any?): Boolean {
- if (other is CircleImpl) {
- return other.id == id
- }
- return false
- }
-
- override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean =
- if (super.onTransact(code, data, reply, flags)) {
- true
- } else {
- Log.d(TAG, "onTransact [unknown]: $code, $data, $flags"); false
- }
-
- companion object {
- val TAG = "GmsMapCircle"
- }
-}
\ No newline at end of file
diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Marker.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Marker.kt
deleted file mode 100644
index 981bc860..00000000
--- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Marker.kt
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.mapbox.model
-
-import android.util.Log
-import com.google.android.gms.dynamic.IObjectWrapper
-import com.google.android.gms.maps.model.LatLng
-import com.google.android.gms.maps.model.MarkerOptions
-import com.google.android.gms.maps.model.internal.IMarkerDelegate
-import com.mapbox.mapboxsdk.plugins.annotation.AnnotationManager
-import com.mapbox.mapboxsdk.plugins.annotation.Symbol
-import com.mapbox.mapboxsdk.plugins.annotation.SymbolOptions
-import org.microg.gms.kotlin.unwrap
-import org.microg.gms.maps.mapbox.GoogleMapImpl
-import org.microg.gms.maps.mapbox.utils.toMapbox
-
-class MarkerImpl(private val map: GoogleMapImpl, private val id: String, options: MarkerOptions) : IMarkerDelegate.Stub(), Markup {
- private var position: LatLng = options.position
- private var visible: Boolean = options.isVisible
- private var rotation: Float = options.rotation
- private var anchor: FloatArray = floatArrayOf(options.anchorU, options.anchorV)
- private var icon: BitmapDescriptorImpl? = options.icon?.remoteObject.unwrap()
- private var alpha: Float = options.alpha
- private var title: String? = options.title
- private var snippet: String? = options.snippet
- private var zIndex: Float = options.zIndex
- private var draggable: Boolean = options.isDraggable
- private var tag: IObjectWrapper? = null
-
- override var annotation: Symbol? = null
- override var removed: Boolean = false
- override val annotationOptions: SymbolOptions
- get() {
- val symbolOptions = SymbolOptions()
- .withIconOpacity(if (visible) alpha else 0f)
- .withIconRotate(rotation)
- .withSymbolSortKey(zIndex)
- .withDraggable(draggable)
-
- position.let { symbolOptions.withLatLng(it.toMapbox()) }
- icon?.applyTo(symbolOptions, anchor, map.dpiFactor)
- return symbolOptions
- }
-
- override fun remove() {
- removed = true
- map.symbolManager?.let { update(it) }
- }
-
- override fun update(manager: AnnotationManager<*, Symbol, SymbolOptions, *, *, *>) {
- synchronized(this) {
- val id = annotation?.id
- if (removed && id != null) {
- map.markers.remove(id)
- }
- super.update(manager)
- val annotation = annotation
- if (annotation != null && id == null) {
- map.markers[annotation.id] = this
- }
- }
- }
-
- override fun getId(): String = id
-
- override fun setPosition(position: LatLng?) {
- this.position = position ?: return
- annotation?.latLng = position.toMapbox()
- map.symbolManager?.let { update(it) }
- }
-
- override fun getPosition(): LatLng = position
-
- override fun setTitle(title: String?) {
- this.title = title
- }
-
- override fun getTitle(): String? = title
-
- override fun setSnippet(snippet: String?) {
- this.snippet = snippet
- }
-
- override fun getSnippet(): String? = snippet
-
- override fun setDraggable(draggable: Boolean) {
- this.draggable = draggable
- annotation?.isDraggable = draggable
- map.symbolManager?.let { update(it) }
- }
-
- override fun isDraggable(): Boolean = draggable
-
- override fun showInfoWindow() {
- Log.d(TAG, "unimplemented Method: showInfoWindow")
- }
-
- override fun hideInfoWindow() {
- Log.d(TAG, "unimplemented Method: hideInfoWindow")
- }
-
- override fun isInfoWindowShown(): Boolean {
- Log.d(TAG, "unimplemented Method: isInfoWindowShow")
- return false
- }
-
- override fun setVisible(visible: Boolean) {
- this.visible = visible
- annotation?.iconOpacity = if (visible) alpha else 0f
- map.symbolManager?.let { update(it) }
- }
-
- override fun isVisible(): Boolean = visible
-
- override fun equals(other: Any?): Boolean {
- if (this === other) return true
- if (other is IMarkerDelegate) return other.id == id
- return false
- }
-
- override fun equalsRemote(other: IMarkerDelegate?): Boolean = equals(other)
-
- override fun hashCode(): Int {
- return id.hashCode()
- }
-
- override fun toString(): String {
- return "$id ($title)"
- }
-
- override fun hashCodeRemote(): Int = hashCode()
-
- override fun setIcon(obj: IObjectWrapper?) {
- obj.unwrap()?.let { icon ->
- this.icon = icon
- annotation?.let { icon.applyTo(it, anchor, map.dpiFactor) }
- }
- map.symbolManager?.let { update(it) }
- }
-
- override fun setAnchor(x: Float, y: Float) {
- anchor = floatArrayOf(x, y)
- annotation?.let { icon?.applyTo(it, anchor, map.dpiFactor) }
- map.symbolManager?.let { update(it) }
- }
-
- override fun setFlat(flat: Boolean) {
- Log.d(TAG, "unimplemented Method: setFlat")
- }
-
- override fun isFlat(): Boolean {
- Log.d(TAG, "unimplemented Method: isFlat")
- return false
- }
-
- override fun setRotation(rotation: Float) {
- this.rotation = rotation
- annotation?.iconRotate = rotation
- map.symbolManager?.let { update(it) }
- }
-
- override fun getRotation(): Float = rotation
-
- override fun setInfoWindowAnchor(x: Float, y: Float) {
- Log.d(TAG, "unimplemented Method: setInfoWindowAnchor")
- }
-
- override fun setAlpha(alpha: Float) {
- this.alpha = alpha
- annotation?.iconOpacity = if (visible) alpha else 0f
- map.symbolManager?.let { update(it) }
- }
-
- override fun getAlpha(): Float = alpha
-
- override fun setZIndex(zIndex: Float) {
- this.zIndex = zIndex
- annotation?.symbolSortKey = zIndex
- map.symbolManager?.let { update(it) }
- }
-
- override fun getZIndex(): Float = zIndex
-
- override fun setTag(obj: IObjectWrapper?) {
- this.tag = obj
- }
-
- override fun getTag(): IObjectWrapper? = tag
-
- companion object {
- private val TAG = "GmsMapMarker"
- }
-}
\ No newline at end of file
diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Markup.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Markup.kt
deleted file mode 100644
index c737afcc..00000000
--- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Markup.kt
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.mapbox.model
-
-import android.util.Log
-import com.mapbox.mapboxsdk.plugins.annotation.Annotation
-import com.mapbox.mapboxsdk.plugins.annotation.AnnotationManager
-import com.mapbox.mapboxsdk.plugins.annotation.Options
-
-interface Markup, S : Options> {
- var annotation: T?
- val annotationOptions: S
- val removed: Boolean
-
- fun update(manager: AnnotationManager<*, T, S, *, *, *>) {
- synchronized(this) {
- if (removed && annotation != null) {
- manager.delete(annotation)
- annotation = null
- } else if (annotation != null) {
- manager.update(annotation)
- } else if (!removed) {
- annotation = manager.create(annotationOptions)
- }
- }
- }
-
- companion object {
- private val TAG = "GmsMapMarkup"
- }
-}
\ No newline at end of file
diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Polygon.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Polygon.kt
deleted file mode 100644
index e3d0d5ea..00000000
--- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Polygon.kt
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.mapbox.model
-
-import android.os.Parcel
-import android.util.Log
-import com.google.android.gms.maps.model.LatLng
-import com.google.android.gms.maps.model.PolygonOptions
-import com.google.android.gms.maps.model.PolylineOptions
-import com.google.android.gms.maps.model.internal.IPolygonDelegate
-import com.mapbox.mapboxsdk.plugins.annotation.AnnotationManager
-import com.mapbox.mapboxsdk.plugins.annotation.Fill
-import com.mapbox.mapboxsdk.plugins.annotation.FillOptions
-import com.mapbox.mapboxsdk.utils.ColorUtils
-import org.microg.gms.maps.mapbox.GoogleMapImpl
-import org.microg.gms.maps.mapbox.utils.toMapbox
-
-class PolygonImpl(private val map: GoogleMapImpl, private val id: String, options: PolygonOptions) : IPolygonDelegate.Stub(), Markup {
- private var points = ArrayList(options.points)
- private var holes: List> = ArrayList(options.holes.map { ArrayList(it) })
- private var fillColor = options.fillColor
- private var strokeColor = options.strokeColor
- private var strokeWidth = options.strokeWidth
- private var visible: Boolean = options.isVisible
-
- private var strokes = (listOf(PolylineImpl(map, "$id-stroke-main", PolylineOptions().color(strokeColor).width(strokeWidth).addAll(points)))
- + holes.mapIndexed { idx, it -> PolylineImpl(map, "$id-stroke-hole-$idx", PolylineOptions().color(strokeColor).width(strokeWidth).addAll(it)) }).toMutableList()
-
- override var annotation: Fill? = null
- override var removed: Boolean = false
- override val annotationOptions: FillOptions
- get() = FillOptions()
- .withLatLngs(mutableListOf(points.map { it.toMapbox() }).plus(holes.map { it.map { it.toMapbox() } }))
- .withFillColor(ColorUtils.colorToRgbaString(fillColor))
- .withFillOpacity(if (visible) 1f else 0f)
-
- override fun remove() {
- removed = true
- map.fillManager?.let { update(it) }
- strokes.forEach { it.remove() }
- }
-
- override fun update(manager: AnnotationManager<*, Fill, FillOptions, *, *, *>) {
- super.update(manager)
- map.lineManager?.let { lineManager -> strokes.forEach { it.update(lineManager) } }
- }
-
- override fun getId(): String = id
-
- override fun setPoints(points: List) {
- this.points = ArrayList(points)
- annotation?.latLngs = mutableListOf(points.map { it.toMapbox() }).plus(holes.map { it.map { it.toMapbox() } })
- map.fillManager?.let { update(it) }
- strokes[0].points = points
- }
-
- override fun getPoints(): List = points
-
- override fun setHoles(holes: List?) {
- this.holes = if (holes == null) emptyList() else ArrayList(holes.mapNotNull { if (it is List<*>) it.mapNotNull { if (it is LatLng) it else null }.let { if (it.isNotEmpty()) it else null } else null })
- annotation?.latLngs = mutableListOf(points.map { it.toMapbox() }).plus(this.holes.map { it.map { it.toMapbox() } })
- while (strokes.size > this.holes.size + 1) {
- val last = strokes.last()
- last.remove()
- strokes.remove(last)
- }
- strokes.forEachIndexed { idx, it -> if (idx > 0) it.points = this.holes[idx - 1] }
- if (this.holes.size + 1 > strokes.size) {
- strokes.addAll(this.holes.subList(strokes.size, this.holes.size - 1).mapIndexed { idx, it -> PolylineImpl(map, "$id-stroke-hole-${strokes.size + idx}", PolylineOptions().color(strokeColor).width(strokeWidth).addAll(it)) })
- }
- map.fillManager?.let { update(it) }
- }
-
- override fun getHoles(): List = holes
-
- override fun setStrokeWidth(width: Float) {
- this.strokeWidth = width
- strokes.forEach { it.width = width }
- }
-
- override fun getStrokeWidth(): Float = strokeWidth
-
- override fun setStrokeColor(color: Int) {
- this.strokeColor = color
- strokes.forEach { it.color = color }
- }
-
- override fun getStrokeColor(): Int = strokeColor
-
- override fun setFillColor(color: Int) {
- this.fillColor = color
- annotation?.setFillColor(color)
- map.fillManager?.let { update(it) }
- }
-
- override fun getFillColor(): Int = fillColor
-
- override fun setZIndex(zIndex: Float) {
- Log.d(TAG, "unimplemented Method: setZIndex")
- }
-
- override fun getZIndex(): Float {
- Log.d(TAG, "unimplemented Method: getZIndex")
- return 0f
- }
-
- override fun setVisible(visible: Boolean) {
- this.visible = visible
- annotation?.fillOpacity = if (visible) 1f else 0f
- map.fillManager?.let { update(it) }
- }
-
- override fun isVisible(): Boolean = visible
-
- override fun setGeodesic(geod: Boolean) {
- Log.d(TAG, "unimplemented Method: setGeodesic")
- }
-
- override fun isGeodesic(): Boolean {
- Log.d(TAG, "unimplemented Method: isGeodesic")
- return false
- }
-
- override fun equalsRemote(other: IPolygonDelegate?): Boolean = equals(other)
-
- override fun hashCodeRemote(): Int = hashCode()
-
- override fun hashCode(): Int {
- return id.hashCode()
- }
-
- override fun toString(): String {
- return id
- }
-
- override fun equals(other: Any?): Boolean {
- if (other is PolygonImpl) {
- return other.id == id
- }
- return false
- }
-
- override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean =
- if (super.onTransact(code, data, reply, flags)) {
- true
- } else {
- Log.d(TAG, "onTransact [unknown]: $code, $data, $flags"); false
- }
-
- companion object {
- private val TAG = "GmsMapPolygon"
- }
-}
\ No newline at end of file
diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Polyline.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Polyline.kt
deleted file mode 100644
index f9a8f91b..00000000
--- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Polyline.kt
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.mapbox.model
-
-import android.os.Parcel
-import android.util.Log
-import com.google.android.gms.maps.model.LatLng
-import com.google.android.gms.maps.model.internal.IPolylineDelegate
-import com.mapbox.mapboxsdk.plugins.annotation.Line
-import com.mapbox.mapboxsdk.plugins.annotation.LineOptions
-import com.mapbox.mapboxsdk.utils.ColorUtils
-import org.microg.gms.maps.mapbox.GoogleMapImpl
-import org.microg.gms.maps.mapbox.utils.toMapbox
-import com.google.android.gms.maps.model.PolylineOptions as GmsLineOptions
-
-class PolylineImpl(private val map: GoogleMapImpl, private val id: String, options: GmsLineOptions) : IPolylineDelegate.Stub(), Markup {
- private var points = ArrayList(options.points)
- private var width = options.width
- private var color = options.color
- private var visible: Boolean = options.isVisible
-
- override var annotation: Line? = null
- override var removed: Boolean = false
- override val annotationOptions: LineOptions
- get() = LineOptions()
- .withLatLngs(points.map { it.toMapbox() })
- .withLineWidth(width / map.dpiFactor)
- .withLineColor(ColorUtils.colorToRgbaString(color))
- .withLineOpacity(if (visible) 1f else 0f)
-
- override fun remove() {
- removed = true
- map.lineManager?.let { update(it) }
- }
-
- override fun getId(): String = id
-
- override fun setPoints(points: List) {
- this.points = ArrayList(points)
- annotation?.latLngs = points.map { it.toMapbox() }
- map.lineManager?.let { update(it) }
- }
-
- override fun getPoints(): List = points
-
- override fun setWidth(width: Float) {
- this.width = width
- annotation?.lineWidth = width / map.dpiFactor
- map.lineManager?.let { update(it) }
- }
-
- override fun getWidth(): Float = width
-
- override fun setColor(color: Int) {
- this.color = color
- annotation?.setLineColor(color)
- map.lineManager?.let { update(it) }
- }
-
- override fun getColor(): Int = color
-
- override fun setZIndex(zIndex: Float) {
- Log.d(TAG, "unimplemented Method: setZIndex")
- }
-
- override fun getZIndex(): Float {
- Log.d(TAG, "unimplemented Method: getZIndex")
- return 0f
- }
-
- override fun setVisible(visible: Boolean) {
- this.visible = visible
- annotation?.lineOpacity = if (visible) 1f else 0f
- map.lineManager?.let { update(it) }
- }
-
- override fun isVisible(): Boolean = visible
-
- override fun setGeodesic(geod: Boolean) {
- Log.d(TAG, "unimplemented Method: setGeodesic")
- }
-
- override fun isGeodesic(): Boolean {
- Log.d(TAG, "unimplemented Method: isGeodesic")
- return false
- }
-
- override fun equalsRemote(other: IPolylineDelegate?): Boolean = equals(other)
-
- override fun hashCodeRemote(): Int = hashCode()
-
- override fun hashCode(): Int {
- return id.hashCode()
- }
-
- override fun toString(): String {
- return id
- }
-
- override fun equals(other: Any?): Boolean {
- if (other is PolylineImpl) {
- return other.id == id
- }
- return false
- }
-
- override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean =
- if (super.onTransact(code, data, reply, flags)) {
- true
- } else {
- Log.d(TAG, "onTransact [unknown]: $code, $data, $flags"); false
- }
-
- companion object {
- private val TAG = "GmsMapPolyline"
- }
-}
\ No newline at end of file
diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MapContext.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MapContext.kt
deleted file mode 100644
index 2b00202a..00000000
--- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MapContext.kt
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.mapbox.utils
-
-import android.content.Context
-import android.content.ContextWrapper
-import android.content.Intent
-import android.content.SharedPreferences
-import android.view.LayoutInflater
-import org.microg.gms.common.Constants
-import java.io.File
-
-class MapContext(private val context: Context) : ContextWrapper(context.createPackageContext(Constants.GMS_PACKAGE_NAME, Context.CONTEXT_INCLUDE_CODE and Context.CONTEXT_IGNORE_SECURITY)) {
- private var layoutInflater: LayoutInflater? = null
- private val appContext: Context
- get() = context.applicationContext ?: context
-
- override fun getApplicationContext(): Context {
- return this
- }
-
- override fun getCacheDir(): File {
- val cacheDir = File(appContext.cacheDir, "com.google.android.gms")
- cacheDir.mkdirs()
- return cacheDir
- }
-
- override fun getFilesDir(): File {
- val filesDir = File(appContext.filesDir, "com.google.android.gms")
- filesDir.mkdirs()
- return filesDir
- }
-
- override fun getPackageName(): String {
- return appContext.packageName
- }
-
- override fun getClassLoader(): ClassLoader {
- return MapContext::class.java.classLoader!!
- }
-
- override fun getSharedPreferences(name: String?, mode: Int): SharedPreferences {
- return appContext.getSharedPreferences("com.google.android.gms_$name", mode)
- }
-
- override fun getSystemService(name: String): Any? {
- if (name == Context.LAYOUT_INFLATER_SERVICE) {
- if (layoutInflater == null) {
- layoutInflater = super.getSystemService(name) as LayoutInflater
- layoutInflater?.cloneInContext(this)?.let { layoutInflater = it }
- }
- if (layoutInflater != null) {
- return layoutInflater
- }
- }
- return context.getSystemService(name)
- }
-
- override fun startActivity(intent: Intent?) {
- context.startActivity(intent)
- }
-
- companion object {
- val TAG = "GmsMapContext"
- }
-}
\ No newline at end of file
diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MultiArchLoader.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MultiArchLoader.kt
deleted file mode 100644
index 598860f0..00000000
--- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/MultiArchLoader.kt
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.mapbox.utils
-
-import android.annotation.SuppressLint
-import android.content.Context
-import android.content.pm.ApplicationInfo
-import android.util.Log
-import com.mapbox.mapboxsdk.LibraryLoader
-import java.io.*
-import java.util.zip.ZipFile
-
-class MultiArchLoader(private val mapContext: Context, private val appContext: Context) : LibraryLoader() {
- @SuppressLint("UnsafeDynamicallyLoadedCode")
- override fun load(name: String) {
- try {
- val otherAppInfo = mapContext.packageManager.getApplicationInfo(appContext.packageName, 0)
- var primaryCpuAbi = ApplicationInfo::class.java.getField("primaryCpuAbi").get(otherAppInfo) as String?
- if (primaryCpuAbi == "armeabi") {
- primaryCpuAbi = "armeabi-v7a"
- }
- if (primaryCpuAbi != null) {
- val path = "lib/$primaryCpuAbi/lib$name.so"
- val cacheFile = File("${appContext.cacheDir.absolutePath}/.gmscore/$path")
- cacheFile.parentFile.mkdirs()
- val apkFile = File(mapContext.packageCodePath)
- if (!cacheFile.exists() || cacheFile.lastModified() < apkFile.lastModified()) {
- val zipFile = ZipFile(apkFile)
- val entry = zipFile.getEntry(path)
- if (entry != null) {
- copyInputStream(zipFile.getInputStream(entry), FileOutputStream(cacheFile))
- } else {
- Log.d(TAG, "Can't load native library: $path does not exist in $apkFile")
- }
- }
- Log.d(TAG, "Loading $name from ${cacheFile.getPath()}")
- System.load(cacheFile.absolutePath)
- return
- }
- } catch (e: Exception) {
- Log.w(TAG, e)
- }
- Log.d(TAG, "Loading native $name")
- System.loadLibrary(name)
- }
-
- @Throws(IOException::class)
- private fun copyInputStream(inp: InputStream, out: OutputStream) {
- val buffer = ByteArray(1024)
- var len: Int = inp.read(buffer)
- while (len >= 0) {
- out.write(buffer, 0, len)
- len = inp.read(buffer)
- }
-
- inp.close()
- out.close()
- }
-
- companion object {
- private val TAG = "GmsMultiArchLoader"
- }
-
-}
\ No newline at end of file
diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/typeConverter.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/typeConverter.kt
deleted file mode 100644
index d49cef35..00000000
--- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/utils/typeConverter.kt
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.mapbox.utils
-
-import android.os.Bundle
-import com.google.android.gms.maps.internal.ICancelableCallback
-import com.mapbox.mapboxsdk.camera.CameraPosition
-import com.mapbox.mapboxsdk.geometry.LatLng
-import com.mapbox.mapboxsdk.geometry.LatLngBounds
-import com.mapbox.mapboxsdk.geometry.VisibleRegion
-import com.mapbox.mapboxsdk.maps.MapboxMap
-import com.google.android.gms.maps.model.CameraPosition as GmsCameraPosition
-import com.google.android.gms.maps.model.LatLng as GmsLatLng
-import com.google.android.gms.maps.model.LatLngBounds as GmsLatLngBounds
-import com.google.android.gms.maps.model.VisibleRegion as GmsVisibleRegion
-
-fun GmsLatLng.toMapbox(): LatLng =
- LatLng(latitude, longitude)
-
-fun GmsLatLngBounds.toMapbox(): LatLngBounds =
- LatLngBounds.from(this.northeast.latitude, this.northeast.longitude, this.southwest.latitude, this.southwest.longitude)
-
-fun GmsCameraPosition.toMapbox(): CameraPosition =
- CameraPosition.Builder()
- .target(target.toMapbox())
- .zoom(zoom.toDouble() - 1.0)
- .tilt(tilt.toDouble())
- .bearing(bearing.toDouble())
- .build()
-
-fun ICancelableCallback.toMapbox(): MapboxMap.CancelableCallback =
- object : MapboxMap.CancelableCallback {
- override fun onFinish() = this@toMapbox.onFinish()
- override fun onCancel() = this@toMapbox.onCancel()
- }
-
-
-fun Bundle.toMapbox(): Bundle {
- val newBundle = Bundle(this)
- for (key in newBundle.keySet()) {
- val value = newBundle.get(key)
- when (value) {
- is GmsCameraPosition -> newBundle.putParcelable(key, value.toMapbox())
- is GmsLatLng -> newBundle.putParcelable(key, value.toMapbox())
- is GmsLatLngBounds -> newBundle.putParcelable(key, value.toMapbox())
- is Bundle -> newBundle.putBundle(key, value.toMapbox())
- }
- }
- return newBundle
-}
-
-fun LatLng.toGms(): GmsLatLng = GmsLatLng(latitude, longitude)
-
-fun LatLngBounds.toGms(): GmsLatLngBounds = GmsLatLngBounds(southWest.toGms(), northEast.toGms())
-
-fun CameraPosition.toGms(): GmsCameraPosition =
- GmsCameraPosition(target.toGms(), zoom.toFloat() + 1.0f, tilt.toFloat(), bearing.toFloat())
-
-fun Bundle.toGms(): Bundle {
- val newBundle = Bundle(this)
- for (key in newBundle.keySet()) {
- val value = newBundle.get(key)
- when (value) {
- is CameraPosition -> newBundle.putParcelable(key, value.toGms())
- is LatLng -> newBundle.putParcelable(key, value.toGms())
- is LatLngBounds -> newBundle.putParcelable(key, value.toGms())
- is Bundle -> newBundle.putBundle(key, value.toGms())
- }
- }
- return newBundle
-}
-
-fun VisibleRegion.toGms(): GmsVisibleRegion =
- GmsVisibleRegion(nearLeft.toGms(), nearRight.toGms(), farLeft.toGms(), farRight.toGms(), latLngBounds.toGms())
\ No newline at end of file
diff --git a/play-services-maps-core-mapbox/src/main/res/drawable-hdpi/maps_default_marker.png b/play-services-maps-core-mapbox/src/main/res/drawable-hdpi/maps_default_marker.png
deleted file mode 100644
index 94c365a3..00000000
Binary files a/play-services-maps-core-mapbox/src/main/res/drawable-hdpi/maps_default_marker.png and /dev/null differ
diff --git a/play-services-maps-core-mapbox/src/main/res/drawable-ldpi/maps_default_marker.png b/play-services-maps-core-mapbox/src/main/res/drawable-ldpi/maps_default_marker.png
deleted file mode 100644
index a8ca2bf6..00000000
Binary files a/play-services-maps-core-mapbox/src/main/res/drawable-ldpi/maps_default_marker.png and /dev/null differ
diff --git a/play-services-maps-core-mapbox/src/main/res/drawable-mdpi/maps_default_marker.png b/play-services-maps-core-mapbox/src/main/res/drawable-mdpi/maps_default_marker.png
deleted file mode 100644
index c79736e7..00000000
Binary files a/play-services-maps-core-mapbox/src/main/res/drawable-mdpi/maps_default_marker.png and /dev/null differ
diff --git a/play-services-maps-core-mapbox/src/main/res/drawable-xhdpi/maps_default_marker.png b/play-services-maps-core-mapbox/src/main/res/drawable-xhdpi/maps_default_marker.png
deleted file mode 100644
index 0b1b1975..00000000
Binary files a/play-services-maps-core-mapbox/src/main/res/drawable-xhdpi/maps_default_marker.png and /dev/null differ
diff --git a/play-services-maps-core-mapbox/src/main/res/drawable-xxhdpi/maps_default_marker.png b/play-services-maps-core-mapbox/src/main/res/drawable-xxhdpi/maps_default_marker.png
deleted file mode 100644
index 709bf78d..00000000
Binary files a/play-services-maps-core-mapbox/src/main/res/drawable-xxhdpi/maps_default_marker.png and /dev/null differ
diff --git a/play-services-maps-core-mapbox/src/main/res/drawable-xxxhdpi/maps_default_marker.png b/play-services-maps-core-mapbox/src/main/res/drawable-xxxhdpi/maps_default_marker.png
deleted file mode 100644
index 0de5d255..00000000
Binary files a/play-services-maps-core-mapbox/src/main/res/drawable-xxxhdpi/maps_default_marker.png and /dev/null differ
diff --git a/play-services-maps-core-vtm/build.gradle b/play-services-maps-core-vtm/build.gradle
deleted file mode 100644
index 1a00c16e..00000000
--- a/play-services-maps-core-vtm/build.gradle
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2013-2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-apply plugin: "com.android.library"
-
-dependencies {
- implementation project(":play-services-api")
-
- implementation "org.microg:vtm-android:0.9.1-mod"
- implementation "org.microg:vtm-android:0.9.1-mod:natives-armeabi"
- implementation "org.microg:vtm-android:0.9.1-mod:natives-armeabi-v7a"
- implementation "org.microg:vtm-android:0.9.1-mod:natives-arm64-v8a"
- implementation "org.microg:vtm-android:0.9.1-mod:natives-x86"
- implementation "org.microg:vtm-android:0.9.1-mod:natives-x86_64"
- implementation "org.microg:vtm-extras:0.9.1-mod"
- implementation "org.microg:vtm-jts:0.9.1-mod"
- implementation project(":play-services-maps-core-vtm:vtm-microg-theme")
-
- implementation "androidx.appcompat:appcompat:$appcompatVersion"
-}
-
-def execResult(...args) {
- def stdout = new ByteArrayOutputStream()
- exec {
- commandLine args
- standardOutput = stdout
- }
- return stdout.toString().trim()
-}
-
-android {
- compileSdkVersion androidCompileSdk()
- buildToolsVersion "$androidBuildVersionTools"
-
- defaultConfig {
- versionName "temp"
- versionCode 1
-
- minSdkVersion androidMinSdk()
- targetSdkVersion androidTargetSdk()
-
- ndk {
- abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
- }
- }
-
- lintOptions {
- disable "MissingTranslation", "InvalidPackage", "BatteryLife", "ImpliedQuantity", "MissingQuantity"
- }
-
- buildTypes {
- release {
- minifyEnabled true
- proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
- }
- }
-
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
-}
-
-if (file("user.gradle").exists()) {
- apply from: "user.gradle"
-}
diff --git a/play-services-maps-core-vtm/src/main/AndroidManifest.xml b/play-services-maps-core-vtm/src/main/AndroidManifest.xml
deleted file mode 100644
index 31b554e4..00000000
--- a/play-services-maps-core-vtm/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/play-services-maps-core-vtm/src/main/java/com/google/android/gms/maps/internal/CreatorImpl.java b/play-services-maps-core-vtm/src/main/java/com/google/android/gms/maps/internal/CreatorImpl.java
deleted file mode 100644
index 42e83ec3..00000000
--- a/play-services-maps-core-vtm/src/main/java/com/google/android/gms/maps/internal/CreatorImpl.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.google.android.gms.maps.internal;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.res.Resources;
-import android.os.Parcel;
-import android.os.RemoteException;
-import android.util.Log;
-
-import androidx.annotation.Keep;
-
-import com.google.android.gms.dynamic.IObjectWrapper;
-import com.google.android.gms.dynamic.ObjectWrapper;
-import com.google.android.gms.maps.GoogleMapOptions;
-import com.google.android.gms.maps.model.internal.IBitmapDescriptorFactoryDelegate;
-
-import org.microg.gms.maps.vtm.MapFragmentImpl;
-import org.microg.gms.maps.vtm.MapViewImpl;
-import org.microg.gms.maps.vtm.ResourcesContainer;
-import org.microg.gms.maps.vtm.bitmap.BitmapDescriptorFactoryImpl;
-import org.microg.gms.maps.vtm.camera.CameraUpdateFactoryImpl;
-
-@Keep
-public class CreatorImpl extends ICreator.Stub {
- private static final String TAG = "GmsMapCreator";
-
- @Override
- public void init(IObjectWrapper resources) throws RemoteException {
- initV2(resources, 0);
- }
-
- @Override
- public IMapFragmentDelegate newMapFragmentDelegate(IObjectWrapper activity) throws RemoteException {
- return new MapFragmentImpl((Activity) ObjectWrapper.unwrap(activity));
- }
-
- @Override
- public IMapViewDelegate newMapViewDelegate(IObjectWrapper context, GoogleMapOptions options) throws RemoteException {
- return new MapViewImpl((Context) ObjectWrapper.unwrap(context), options);
- }
-
- @Override
- public ICameraUpdateFactoryDelegate newCameraUpdateFactoryDelegate() throws RemoteException {
- return CameraUpdateFactoryImpl.get();
- }
-
- @Override
- public IBitmapDescriptorFactoryDelegate newBitmapDescriptorFactoryDelegate() throws RemoteException {
- return new BitmapDescriptorFactoryImpl();
- }
-
- @Override
- public void initV2(IObjectWrapper resources, int flags) throws RemoteException {
- ResourcesContainer.set((Resources) ObjectWrapper.unwrap(resources));
- }
-
- @Override
- public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
- if (super.onTransact(code, data, reply, flags)) return true;
- Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags);
- return false;
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ApplicationContextWrapper.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ApplicationContextWrapper.java
deleted file mode 100644
index ebb6caa6..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ApplicationContextWrapper.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm;
-
-import android.content.Context;
-import android.content.ContextWrapper;
-import android.content.pm.PackageManager;
-
-import org.microg.gms.common.Constants;
-
-public class ApplicationContextWrapper extends ContextWrapper {
- private Context applicationContext;
-
- public ApplicationContextWrapper(Context base, Context applicationContext) {
- super(base);
- this.applicationContext = applicationContext;
- }
-
- public static ApplicationContextWrapper gmsContextWithAttachedApplicationContext(Context applicationContext) {
- try {
- Context context = applicationContext.createPackageContext(Constants.GMS_PACKAGE_NAME, CONTEXT_INCLUDE_CODE & CONTEXT_IGNORE_SECURITY);
- return new ApplicationContextWrapper(context, applicationContext);
- } catch (PackageManager.NameNotFoundException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static ApplicationContextWrapper matchingApplicationContext(Context context) {
- return new ApplicationContextWrapper(context, context);
- }
-
- @Override
- public Context getApplicationContext() {
- return applicationContext;
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/BackendMap.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/BackendMap.java
deleted file mode 100644
index 2a94e5fb..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/BackendMap.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.os.RemoteException;
-import android.util.Log;
-import android.view.View;
-
-import com.google.android.gms.maps.internal.ISnapshotReadyCallback;
-import com.google.android.gms.maps.model.CameraPosition;
-
-import org.microg.gms.maps.vtm.camera.CameraUpdate;
-import org.microg.gms.maps.vtm.markup.DrawableMarkup;
-import org.microg.gms.maps.vtm.markup.MarkerItemMarkup;
-import org.microg.gms.maps.vtm.markup.Markup;
-import org.oscim.backend.GL;
-import org.oscim.backend.GLAdapter;
-import org.oscim.core.MapPosition;
-import org.oscim.core.Point;
-import org.oscim.event.Event;
-import org.oscim.event.MotionEvent;
-import org.oscim.layers.marker.ItemizedLayer;
-import org.oscim.layers.marker.MarkerItem;
-import org.oscim.layers.vector.geometries.Drawable;
-import org.oscim.map.Viewport;
-
-import java.nio.IntBuffer;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.microedition.khronos.opengles.GL10;
-
-public class BackendMap implements ItemizedLayer.OnItemGestureListener, org.oscim.map.Map.InputListener, org.oscim.map.Map.UpdateListener {
- private final static String TAG = "GmsMapBackend";
-
- private final Context context;
- private final BackendMapView mapView;
- private final ContainerLayout container;
- private final CameraUpdateListener cameraUpdateListener;
- private final Map markupMap = new HashMap();
- private final List drawableMarkups = new ArrayList();
- private MarkerItemMarkup currentlyDraggedItem;
- private float dragLastX = -1;
- private float dragLastY = -1;
-
- public BackendMap(Context context, final CameraUpdateListener cameraUpdateListener) {
- this.context = context;
- this.cameraUpdateListener = cameraUpdateListener;
- mapView = new BackendMapView(context);
- mapView.items().setOnItemGestureListener(this);
- mapView.map().input.bind(this);
- mapView.map().events.bind(this);
- container = new ContainerLayout(context);
- container.addView(mapView);
- }
-
- public Viewport getViewport() {
- return mapView.map().viewport();
- }
-
- public void destroy() {
- mapView.map().destroy();
- }
-
- public void onResume() {
- mapView.onResume();
- }
-
- public void onPause() {
- mapView.onPause();
- }
-
- public MapPosition getMapPosition() {
- return mapView.map().getMapPosition();
- }
-
- public View getView() {
- return container;
- }
-
- public boolean hasBuilding() {
- return mapView.map().layers().contains(mapView.buildings());
- }
-
- public void setBuildings(boolean buildingsEnabled) {
- if (!hasBuilding() && buildingsEnabled) {
- mapView.map().layers().add(mapView.buildings());
- } else if (hasBuilding() && !buildingsEnabled) {
- mapView.map().layers().remove(mapView.buildings());
- }
- redraw();
- }
-
- public void redraw() {
- mapView.map().updateMap(true);
- }
-
- public void applyCameraUpdate(CameraUpdate cameraUpdate) {
- cameraUpdate.apply(mapView.map());
- }
-
- public void applyCameraUpdateAnimated(CameraUpdate cameraUpdate, int durationMs) {
- cameraUpdate.applyAnimated(mapView.map(), durationMs);
- }
-
- public void stopAnimation() {
- mapView.map().animator().cancel();
- }
-
- public synchronized T add(T markup) {
- if (markup == null) return null;
- drawableMarkups.add(markup);
- Collections.sort(drawableMarkups, new Comparator() {
- @Override
- public int compare(DrawableMarkup lhs, DrawableMarkup rhs) {
- return Float.compare(lhs.getZIndex(), rhs.getZIndex());
- }
- });
- updateDrawableLayer();
- redraw();
- return markup;
- }
-
- private synchronized void updateDrawableLayer() {
- mapView.drawables().clear();
- for (DrawableMarkup markup : drawableMarkups) {
- Drawable drawable = markup.getDrawable(mapView.map());
- if (drawable != null) {
- mapView.drawables().add(drawable);
- }
- }
- }
-
- public synchronized T add(T markup) {
- if (markup == null) return null;
- markupMap.put(markup.getId(), markup);
- MarkerItem item = markup.getMarkerItem(context);
- mapView.items().addItem(item);
- redraw();
- return markup;
- }
-
- public synchronized void clear() {
- markupMap.clear();
- mapView.items().removeAllItems();
- drawableMarkups.clear();
- mapView.drawables().clear();
- redraw();
- }
-
- public synchronized void remove(Markup markup) {
- if (markup instanceof MarkerItemMarkup) {
- markupMap.remove(markup.getId());
- MarkerItem toRemove = getByUid(markup.getId());
- if (toRemove != null) mapView.items().removeItem(toRemove);
- } else if (markup instanceof DrawableMarkup) {
- drawableMarkups.remove(markup);
- updateDrawableLayer();
- mapView.drawables().update();
- }
- redraw();
- }
-
- private MarkerItem getByUid(String uid) {
- for (MarkerItem markerItem : mapView.items().getItemList()) {
- if (markerItem.getUid().equals(uid)) {
- return markerItem;
- }
- }
- return null;
- }
-
- public synchronized void update(Markup markup) {
- if (markup == null) return;
- if (markup instanceof MarkerItemMarkup) {
- MarkerItem item = getByUid(markup.getId());
- if (item != null) {
- mapView.items().removeItem(item);
- }
- item = ((MarkerItemMarkup) markup).getMarkerItem(context);
- if (item != null) {
- mapView.items().addItem(item);
- }
- } else if (markup instanceof DrawableMarkup) {
- updateDrawableLayer();
- mapView.drawables().update();
- }
- redraw();
- }
-
- @Override
- public boolean onItemSingleTapUp(int index, MarkerItem item) {
- Markup markup = markupMap.get(item.getUid());
- if (markup != null) {
- if (markup.onClick()) return true;
- }
- return false;
- }
-
- @Override
- public boolean onItemLongPress(int index, MarkerItem item) {
- Markup markup = markupMap.get(item.getUid());
- if (((MarkerItemMarkup) markup).isDraggable()) {
- currentlyDraggedItem = (MarkerItemMarkup) markup;
- currentlyDraggedItem.onDragStart();
- return false;
- } else {
- Log.d(TAG, "onItemLongPress: " + markup);
- return false;
- }
- }
-
- @Override
- public void onInputEvent(Event event, MotionEvent motionEvent) {
- if ((motionEvent.getAction() == MotionEvent.ACTION_CANCEL || motionEvent.getAction() == MotionEvent.ACTION_UP) && currentlyDraggedItem != null) {
- currentlyDraggedItem.onDragStop();
- currentlyDraggedItem = null;
- }
- if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
- dragLastX = motionEvent.getX();
- dragLastY = motionEvent.getY();
- }
- if (motionEvent.getAction() == MotionEvent.ACTION_MOVE && currentlyDraggedItem != null) {
- Point out = new Point();
- mapView.map().viewport().toScreenPoint(GmsMapsTypeHelper.fromLatLng(currentlyDraggedItem.getPosition()), out);
- out.x += mapView.getWidth() / 2;
- out.y += mapView.getHeight() / 2;
- float mx = motionEvent.getX() - dragLastX;
- float my = motionEvent.getY() - dragLastY;
- currentlyDraggedItem.setPosition(GmsMapsTypeHelper.toLatLng(mapView.map().viewport().fromScreenPoint((float) out.getX() + mx, (float) out.getY() + my)));
- currentlyDraggedItem.onDragProgress();
- dragLastX += mx;
- dragLastY += my;
- }
- }
-
- public void snapshot(final Bitmap bitmap, final ISnapshotReadyCallback callback) {
- mapView.queueEvent(new Runnable() {
- @Override
- public void run() {
- Bitmap surface = createBitmapFromGLSurface(0, 0, mapView.getWidth(), mapView.getHeight(), GLAdapter.gl);
- final Bitmap result;
- if (bitmap != null) {
- Canvas c = new Canvas(bitmap);
- c.drawBitmap(surface, 0, 0, new Paint());
- result = bitmap;
- } else {
- result = surface;
- }
- mapView.getHandler().post(new Runnable() {
- @Override
- public void run() {
- Log.d(TAG, "snapshot result: " + result);
- try {
- callback.onBitmapReady(result);
- } catch (RemoteException e) {
- Log.w(TAG, e);
- }
- }
- });
- }
- });
- }
-
- private Bitmap createBitmapFromGLSurface(int x, int y, int w, int h, GL gl) {
- int bitmapBuffer[] = new int[w * h];
- int bitmapSource[] = new int[w * h];
- IntBuffer intBuffer = IntBuffer.wrap(bitmapBuffer);
- intBuffer.position(0);
-
- try {
- gl.readPixels(x, y, w, h, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, intBuffer);
- int offset1, offset2;
- for (int i = 0; i < h; i++) {
- offset1 = i * w;
- offset2 = (h - i - 1) * w;
- for (int j = 0; j < w; j++) {
- int texturePixel = bitmapBuffer[offset1 + j];
- int blue = (texturePixel >> 16) & 0xff;
- int red = (texturePixel << 16) & 0x00ff0000;
- int pixel = (texturePixel & 0xff00ff00) | red | blue;
- bitmapSource[offset2 + j] = pixel;
- }
- }
- } catch (Exception e) {
- Log.e(TAG, "createBitmapFromGLSurface: " + e.getMessage(), e);
- return null;
- }
-
- return Bitmap.createBitmap(bitmapSource, w, h, Bitmap.Config.ARGB_8888);
- }
-
- public void setZoomGesturesEnabled(boolean enabled) {
- mapView.map().getEventLayer().enableZoom(enabled);
- }
-
- public void setScrollGesturesEnabled(boolean enabled) {
- mapView.map().getEventLayer().enableMove(enabled);
- }
-
- public void setRotateGesturesEnabled(boolean enabled) {
- mapView.map().getEventLayer().enableRotation(enabled);
- }
-
- public void setTiltGesturesEnabled(boolean enabled) {
- mapView.map().getEventLayer().enableTilt(enabled);
- }
-
- @Override
- public void onMapEvent(Event event, MapPosition mapPosition) {
- if (event == org.oscim.map.Map.ANIM_END || event == org.oscim.map.Map.POSITION_EVENT || event == org.oscim.map.Map.MOVE_EVENT)
- cameraUpdateListener.onCameraUpdate(GmsMapsTypeHelper.toCameraPosition(mapPosition));
- }
-
- public interface CameraUpdateListener {
- void onCameraUpdate(CameraPosition cameraPosition);
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/BackendMapView.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/BackendMapView.java
deleted file mode 100644
index 6af341e6..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/BackendMapView.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm;
-
-import android.content.Context;
-import android.content.ContextWrapper;
-import android.content.pm.ApplicationInfo;
-import android.graphics.BitmapFactory;
-import android.util.AttributeSet;
-import android.util.Log;
-
-import org.microg.gms.maps.vtm.data.SharedTileCache;
-import org.microg.gms.maps.vtm.markup.ClearableVectorLayer;
-import org.microg.gms.maps.vtm.R;
-import org.oscim.android.AndroidAssets;
-import org.oscim.android.MapView;
-import org.oscim.android.canvas.AndroidBitmap;
-import org.oscim.layers.marker.ItemizedLayer;
-import org.oscim.layers.marker.MarkerItem;
-import org.oscim.layers.marker.MarkerSymbol;
-import org.oscim.layers.tile.buildings.BuildingLayer;
-import org.oscim.layers.tile.vector.VectorTileLayer;
-import org.oscim.layers.tile.vector.labeling.LabelLayer;
-import org.oscim.map.Layers;
-import org.oscim.theme.MicrogThemes;
-import org.oscim.tiling.ITileCache;
-import org.oscim.tiling.source.oscimap4.OSciMap4TileSource;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Enumeration;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-public class BackendMapView extends MapView {
- private static final String TAG = "GmsMapView";
-
- private static boolean nativeLibLoaded = false;
- private LabelLayer labels;
- private BuildingLayer buildings;
- private ItemizedLayer items;
- private ClearableVectorLayer drawables;
-
- static synchronized Context loadNativeLib(Context context) {
- try {
- if (nativeLibLoaded) return context;
- ApplicationInfo otherAppInfo = context.getPackageManager().getApplicationInfo(context.getApplicationContext().getPackageName(), 0);
-
- String primaryCpuAbi = (String) ApplicationInfo.class.getField("primaryCpuAbi").get(otherAppInfo);
- if (primaryCpuAbi != null) {
- String path = "lib/" + primaryCpuAbi + "/libvtm-jni.so";
- File cacheFile = new File(context.getApplicationContext().getCacheDir().getAbsolutePath() + "/.gmscore/" + path);
- cacheFile.getParentFile().mkdirs();
- File apkFile = new File(context.getPackageCodePath());
- if (!cacheFile.exists() || cacheFile.lastModified() < apkFile.lastModified()) {
- ZipFile zipFile = new ZipFile(apkFile);
- ZipEntry entry = zipFile.getEntry(path);
- if (entry != null) {
- copyInputStream(zipFile.getInputStream(entry), new FileOutputStream(cacheFile));
- } else {
- Log.d(TAG, "Can't load native library: " + path + " does not exist in " + apkFile);
- }
- }
- Log.d(TAG, "Loading vtm-jni from " + cacheFile.getPath());
- System.load(cacheFile.getAbsolutePath());
- nativeLibLoaded = true;
- }
- } catch (Exception e) {
- Log.w(TAG, e);
- }
- if (!nativeLibLoaded) {
- Log.d(TAG, "Loading native vtm-jni");
- System.loadLibrary("vtm-jni");
- nativeLibLoaded = true;
- }
- return context;
- }
-
- private static final void copyInputStream(InputStream in, OutputStream out) throws IOException {
- byte[] buffer = new byte[1024];
- int len;
-
- while ((len = in.read(buffer)) >= 0)
- out.write(buffer, 0, len);
-
- in.close();
- out.close();
- }
-
- @Override
- public void onResume() {
- super.onResume();
- }
-
- @Override
- public void onPause() {
- super.onPause();
- }
-
- public BackendMapView(Context context) {
- super(loadNativeLib(context));
- if (context instanceof ContextWrapper) {
- AndroidAssets.init(ApplicationContextWrapper.matchingApplicationContext(((ContextWrapper) context).getBaseContext()));
- }
- initialize();
- }
-
- public BackendMapView(Context context, AttributeSet attributeSet) {
- super(loadNativeLib(context), attributeSet);
- initialize();
- }
-
- ItemizedLayer items() {
- return items;
- }
-
- BuildingLayer buildings() {
- return buildings;
- }
-
- ClearableVectorLayer drawables() {
- return drawables;
- }
-
- private void initialize() {
- ITileCache cache = new SharedTileCache(getContext());
- cache.setCacheSize(512 * (1 << 10));
- OSciMap4TileSource tileSource = new OSciMap4TileSource();
- tileSource.setCache(cache);
- VectorTileLayer baseLayer = map().setBaseMap(tileSource);
- Layers layers = map().layers();
- layers.add(drawables = new ClearableVectorLayer(map()));
- layers.add(labels = new LabelLayer(map(), baseLayer));
- layers.add(buildings = new BuildingLayer(map(), baseLayer));
- layers.add(items = new ItemizedLayer(map(), new MarkerSymbol(
- new AndroidBitmap(BitmapFactory.decodeResource(getContext().getResources(), R.drawable.nop)), 0.5F, 1)));
- map().setTheme(MicrogThemes.DEFAULT);
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ContainerLayout.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ContainerLayout.java
deleted file mode 100644
index 468d38b4..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ContainerLayout.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm;
-
-import android.content.Context;
-import android.widget.FrameLayout;
-
-import org.oscim.utils.ThreadUtils;
-
-public class ContainerLayout extends FrameLayout {
- public ContainerLayout(Context context) {
- super(context);
- }
-
- @Override
- protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
- ThreadUtils.init();
- super.onLayout(changed, left, top, right, bottom);
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/GmsMapsTypeHelper.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/GmsMapsTypeHelper.java
deleted file mode 100644
index c68b9460..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/GmsMapsTypeHelper.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm;
-
-import com.google.android.gms.maps.model.CameraPosition;
-import com.google.android.gms.maps.model.LatLng;
-import com.google.android.gms.maps.model.LatLngBounds;
-
-import org.oscim.core.BoundingBox;
-import org.oscim.core.Box;
-import org.oscim.core.GeoPoint;
-import org.oscim.core.MapPosition;
-import org.oscim.core.MercatorProjection;
-
-public class GmsMapsTypeHelper {
- public static android.graphics.Point toPoint(org.oscim.core.Point in) {
- return new android.graphics.Point((int) in.getX(), (int) in.getY());
- }
-
- public static GeoPoint fromLatLng(LatLng latLng) {
- return new GeoPoint(latLng.latitude, latLng.longitude);
- }
-
- public static LatLng toLatLng(GeoPoint geoPoint) {
- return new LatLng(geoPoint.getLatitude(), geoPoint.getLongitude());
- }
-
- public static LatLngBounds toLatLngBounds(Box box) {
- double minLon = MercatorProjection.toLongitude(box.xmin);
- double maxLon = MercatorProjection.toLongitude(box.xmax);
- double minLat = MercatorProjection.toLatitude(box.ymax);
- double maxLat = MercatorProjection.toLatitude(box.ymin);
- if (Double.isNaN(minLon) || Double.isNaN(maxLon) || Double.isNaN(minLat) || Double.isNaN(maxLat))
- minLon = maxLon = minLat = maxLat = 0;
- return new LatLngBounds(new LatLng(minLat, minLon), new LatLng(maxLat, maxLon));
- }
-
- public static org.oscim.core.Point fromPoint(android.graphics.Point point) {
- return new org.oscim.core.Point(point.x, point.y);
- }
-
- public static CameraPosition toCameraPosition(MapPosition mapPosition) {
- return new CameraPosition(new LatLng(mapPosition.getLatitude(), mapPosition.getLongitude()),
- toZoom(mapPosition.getScale()), mapPosition.getTilt(),
- toBearing(mapPosition.getBearing()));
- }
-
- public static MapPosition fromCameraPosition(CameraPosition cameraPosition) {
- MapPosition mapPosition = new MapPosition(cameraPosition.target.latitude,
- cameraPosition.target.longitude, fromZoom(cameraPosition.zoom));
- mapPosition.setTilt(cameraPosition.tilt);
- mapPosition.setBearing(fromBearing(cameraPosition.bearing));
- return mapPosition;
- }
-
- public static BoundingBox fromLatLngBounds(LatLngBounds bounds) {
- return new BoundingBox(bounds.southwest.latitude, bounds.southwest.longitude,
- bounds.northeast.latitude, bounds.northeast.longitude);
- }
-
- public static float fromBearing(float bearing) {
- return -bearing;
- }
-
- public static float toBearing(float bearing) {
- return -bearing;
- }
-
- public static double fromZoom(float zoom) {
- return Math.pow(2, zoom);
- }
-
- public static float toZoom(double scale) {
- return (float) (Math.log(scale) / Math.log(2));
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/GoogleMapImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/GoogleMapImpl.java
deleted file mode 100644
index f34c066e..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/GoogleMapImpl.java
+++ /dev/null
@@ -1,707 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.location.Criteria;
-import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.Parcel;
-import android.os.RemoteException;
-import android.util.Log;
-import android.view.View;
-
-import androidx.core.content.ContextCompat;
-
-import com.google.android.gms.dynamic.IObjectWrapper;
-import com.google.android.gms.dynamic.ObjectWrapper;
-import com.google.android.gms.maps.GoogleMapOptions;
-import com.google.android.gms.maps.internal.ICancelableCallback;
-import com.google.android.gms.maps.internal.IGoogleMapDelegate;
-import com.google.android.gms.maps.internal.IInfoWindowAdapter;
-import com.google.android.gms.maps.internal.ILocationSourceDelegate;
-import com.google.android.gms.maps.internal.IOnCameraChangeListener;
-import com.google.android.gms.maps.internal.IOnCameraIdleListener;
-import com.google.android.gms.maps.internal.IOnCameraMoveCanceledListener;
-import com.google.android.gms.maps.internal.IOnCameraMoveListener;
-import com.google.android.gms.maps.internal.IOnCameraMoveStartedListener;
-import com.google.android.gms.maps.internal.IOnInfoWindowClickListener;
-import com.google.android.gms.maps.internal.IOnMapClickListener;
-import com.google.android.gms.maps.internal.IOnMapLoadedCallback;
-import com.google.android.gms.maps.internal.IOnMapLongClickListener;
-import com.google.android.gms.maps.internal.IOnMarkerClickListener;
-import com.google.android.gms.maps.internal.IOnMarkerDragListener;
-import com.google.android.gms.maps.internal.IOnMyLocationButtonClickListener;
-import com.google.android.gms.maps.internal.IOnMyLocationChangeListener;
-import com.google.android.gms.maps.internal.IProjectionDelegate;
-import com.google.android.gms.maps.internal.ISnapshotReadyCallback;
-import com.google.android.gms.maps.internal.IUiSettingsDelegate;
-import com.google.android.gms.maps.model.CameraPosition;
-import com.google.android.gms.maps.model.CircleOptions;
-import com.google.android.gms.maps.model.GroundOverlayOptions;
-import com.google.android.gms.maps.model.LatLngBounds;
-import com.google.android.gms.maps.model.MarkerOptions;
-import com.google.android.gms.maps.model.PolygonOptions;
-import com.google.android.gms.maps.model.PolylineOptions;
-import com.google.android.gms.maps.model.TileOverlayOptions;
-import com.google.android.gms.maps.model.internal.ICircleDelegate;
-import com.google.android.gms.maps.model.internal.IGroundOverlayDelegate;
-import com.google.android.gms.maps.model.internal.IMarkerDelegate;
-import com.google.android.gms.maps.model.internal.IPolygonDelegate;
-import com.google.android.gms.maps.model.internal.IPolylineDelegate;
-import com.google.android.gms.maps.model.internal.ITileOverlayDelegate;
-
-import org.microg.gms.maps.vtm.camera.CameraUpdate;
-import org.microg.gms.maps.vtm.camera.MapPositionCameraUpdate;
-import org.microg.gms.maps.vtm.markup.CircleImpl;
-import org.microg.gms.maps.vtm.markup.GroundOverlayImpl;
-import org.microg.gms.maps.vtm.markup.MarkerImpl;
-import org.microg.gms.maps.vtm.markup.Markup;
-import org.microg.gms.maps.vtm.markup.PolygonImpl;
-import org.microg.gms.maps.vtm.markup.PolylineImpl;
-import org.microg.gms.maps.vtm.markup.TileOverlayImpl;
-
-import static android.Manifest.permission.ACCESS_COARSE_LOCATION;
-import static android.Manifest.permission.ACCESS_FINE_LOCATION;
-import static android.content.pm.PackageManager.PERMISSION_GRANTED;
-
-public class GoogleMapImpl extends IGoogleMapDelegate.Stub
- implements UiSettingsImpl.UiSettingsListener, Markup.MarkupListener, BackendMap.CameraUpdateListener {
- private static final String TAG = "GmsMapImpl";
-
- private final GoogleMapOptions options;
- private final Context context;
- private final BackendMap backendMap;
- private final UiSettingsImpl uiSettings;
- private final ProjectionImpl projection;
-
- private int markerCounter = 0;
- private int circleCounter = 0;
- private int polylineCounter = 0;
- private int polygonCounter = 0;
-
- private IOnMarkerClickListener onMarkerClickListener;
- private IOnMarkerDragListener onMarkerDragListener;
- private IOnCameraChangeListener onCameraChangeListener;
- private IOnMyLocationChangeListener onMyLocationChangeListener;
-
- private Criteria criteria;
- private Location myLocation;
- private LocationListener listener = new LocationListener() {
- @Override
- public void onLocationChanged(Location location) {
- // TODO: Actually do my location overlay
- myLocation = location;
- if (onMyLocationChangeListener != null && location != null) {
- try {
- onMyLocationChangeListener.onMyLocationChanged(ObjectWrapper.wrap(location));
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
- }
-
- @Override
- public void onStatusChanged(String provider, int status, Bundle extras) {
- }
-
- @Override
- public void onProviderEnabled(String provider) {
- }
-
- @Override
- public void onProviderDisabled(String provider) {
- }
- };
-
- private GoogleMapImpl(Context context, GoogleMapOptions options) {
- this.context = context;
- Context appContext = context;
- if (appContext.getApplicationContext() != null)
- appContext = appContext.getApplicationContext();
- Context wrappedContext = ApplicationContextWrapper.gmsContextWithAttachedApplicationContext(appContext);
- backendMap = new BackendMap(wrappedContext, this);
- uiSettings = new UiSettingsImpl(this);
- projection = new ProjectionImpl(backendMap.getViewport());
- this.options = options;
-
- criteria = new Criteria();
- criteria.setAccuracy(Criteria.ACCURACY_COARSE);
- criteria.setPowerRequirement(Criteria.POWER_MEDIUM);
-
- if (options != null) initFromOptions();
- }
-
- public synchronized static GoogleMapImpl create(Context context, GoogleMapOptions options) {
- return new GoogleMapImpl(context, options);
- }
-
- private void initFromOptions() {
- try {
- uiSettings.setCompassEnabled(options.getCompassEnabled());
- uiSettings.setRotateGesturesEnabled(options.isRotateGesturesEnabled());
- uiSettings.setTiltGesturesEnabled(options.isTiltGesturesEnabled());
- uiSettings.setScrollGesturesEnabled(options.isScrollGesturesEnabled());
- uiSettings.setZoomControlsEnabled(options.isZoomControlsEnabled());
- uiSettings.setZoomGesturesEnabled(options.isZoomGesturesEnabled());
- if (options.getCamera() != null) {
- backendMap.applyCameraUpdate(MapPositionCameraUpdate.directMapPosition(GmsMapsTypeHelper.fromCameraPosition(options.getCamera())));
- }
- } catch (RemoteException e) {
- // Never happens: not remote
- }
- }
-
- public void onDestroy() {
- backendMap.destroy();
- }
-
- @Override
- public void onLowMemory() throws RemoteException {
- Log.d(TAG, "unimplemented Method: onLowMemory");
-
- }
-
- @Override
- public boolean useViewLifecycleWhenInFragment() throws RemoteException {
- Log.d(TAG, "unimplemented Method: useViewLifecycleWhenInFragment");
- return false;
- }
-
- @Override
- public void onSaveInstanceState(Bundle outState) throws RemoteException {
- Log.d(TAG, "unimplemented Method: onSaveInstanceState");
-
- }
-
- @Override
- public void setContentDescription(String desc) throws RemoteException {
- Log.d(TAG, "unimplemented Method: setContentDescription");
-
- }
-
- @Override
- public void onEnterAmbient(Bundle bundle) throws RemoteException {
- Log.d(TAG, "unimplemented Method: onEnterAmbient");
-
- }
-
- @Override
- public void onExitAmbient() throws RemoteException {
- Log.d(TAG, "unimplemented Method: onExitAmbient");
-
- }
-
- @Override
- public void setMinZoomPreference(float minZoom) throws RemoteException {
- Log.d(TAG, "unimplemented Method: setMinZoomPreference");
-
- }
-
- @Override
- public void setMaxZoomPreference(float maxZoom) throws RemoteException {
- Log.d(TAG, "unimplemented Method: setMaxZoomPreference");
-
- }
-
- @Override
- public void resetMinMaxZoomPreference() throws RemoteException {
- Log.d(TAG, "unimplemented Method: resetMinMaxZoomPreference");
-
- }
-
- @Override
- public void setLatLngBoundsForCameraTarget(LatLngBounds bounds) throws RemoteException {
- Log.d(TAG, "unimplemented Method: setLatLngBoundsForCameraTarget");
-
- }
-
- public void onResume() {
- backendMap.onResume();
- }
-
- public void onPause() {
- backendMap.onPause();
- }
-
- public View getView() {
- return backendMap.getView();
- }
-
- private String getNextMarkerId() {
- return "m" + markerCounter++;
- }
-
- private String getNextCircleId() {
- return "c" + circleCounter++;
- }
-
- private String getNextPolylineId() {
- return "l" + polylineCounter++;
- }
-
- private String getNextPolygonId() {
- return "p" + polygonCounter++;
- }
-
- /*
- Camera
- */
-
- @Override
- public CameraPosition getCameraPosition() throws RemoteException {
- return GmsMapsTypeHelper.toCameraPosition(backendMap.getMapPosition());
- }
-
- @Override
- public float getMaxZoomLevel() throws RemoteException {
- return (float) backendMap.getViewport().limitScale(Double.MIN_VALUE);
- }
-
- @Override
- public float getMinZoomLevel() throws RemoteException {
- return (float) backendMap.getViewport().limitScale(Double.MAX_VALUE);
- }
-
- @Override
- public void moveCamera(IObjectWrapper cameraUpdate) throws RemoteException {
- CameraUpdate camUpdate = (CameraUpdate) ObjectWrapper.unwrap(cameraUpdate);
- backendMap.applyCameraUpdate(camUpdate);
- }
-
- @Override
- public void animateCamera(IObjectWrapper cameraUpdate) throws RemoteException {
- CameraUpdate camUpdate = (CameraUpdate) ObjectWrapper.unwrap(cameraUpdate);
- backendMap.applyCameraUpdateAnimated(camUpdate, 1000);
- }
-
- @Override
- public void animateCameraWithCallback(IObjectWrapper cameraUpdate, ICancelableCallback callback)
- throws RemoteException {
- CameraUpdate camUpdate = (CameraUpdate) ObjectWrapper.unwrap(cameraUpdate);
- backendMap.applyCameraUpdateAnimated(camUpdate, 1000);
- }
-
- @Override
- public void animateCameraWithDurationAndCallback(IObjectWrapper cameraUpdate, int duration,
- ICancelableCallback callback) throws RemoteException {
- CameraUpdate camUpdate = (CameraUpdate) ObjectWrapper.unwrap(cameraUpdate);
- backendMap.applyCameraUpdateAnimated(camUpdate, duration);
- }
-
- @Override
- public IProjectionDelegate getProjection() throws RemoteException {
- return projection;
- }
-
- @Override
- public void stopAnimation() throws RemoteException {
- backendMap.stopAnimation();
- }
-
- @Override
- public void onCameraUpdate(CameraPosition cameraPosition) {
- if (onCameraChangeListener != null) {
- try {
- onCameraChangeListener.onCameraChange(cameraPosition);
- } catch (RemoteException e) {
- Log.w(TAG, e);
- }
- }
- }
-
- /*
- Markers, polylines, polygons, overlays, etc
- */
-
- @Override
- public ICircleDelegate addCircle(CircleOptions options) throws RemoteException {
- return backendMap.add(new CircleImpl(getNextCircleId(), options, this));
- }
-
- @Override
- public IPolylineDelegate addPolyline(PolylineOptions options) throws RemoteException {
- return backendMap.add(new PolylineImpl(getNextPolylineId(), options, this));
- }
-
- @Override
- public IPolygonDelegate addPolygon(PolygonOptions options) throws RemoteException {
- return backendMap.add(new PolygonImpl(getNextPolygonId(), options, this));
- }
-
- @Override
- public IMarkerDelegate addMarker(MarkerOptions options) throws RemoteException {
- return backendMap.add(new MarkerImpl(getNextMarkerId(), options, this));
- }
-
- @Override
- public IGroundOverlayDelegate addGroundOverlay(GroundOverlayOptions options)
- throws RemoteException {
- Log.d(TAG, "not yet usable: addGroundOverlay");
- return new GroundOverlayImpl(options); // TODO
- }
-
- @Override
- public ITileOverlayDelegate addTileOverlay(TileOverlayOptions options) throws RemoteException {
- Log.d(TAG, "not yet usable: addTileOverlay");
- return new TileOverlayImpl(); // TODO
- }
-
- @Override
- public void setInfoWindowAdapter(IInfoWindowAdapter adapter) throws RemoteException {
- Log.d(TAG, "not yet usable: setInfoWindowAdapter");
- }
-
- @Override
- public void clear() throws RemoteException {
- backendMap.clear();
- markerCounter = 0;
- circleCounter = 0;
- polylineCounter = 0;
- polygonCounter = 0;
- }
-
- @Override
- public void update(Markup markup) {
- backendMap.update(markup);
- }
-
- @Override
- public void remove(Markup markup) {
- backendMap.remove(markup);
- }
-
- @Override
- public boolean onClick(Markup markup) {
- if (markup instanceof IMarkerDelegate) {
- if (onMarkerClickListener != null) {
- try {
- if (onMarkerClickListener.onMarkerClick((IMarkerDelegate) markup))
- return true;
- } catch (RemoteException e) {
- Log.w(TAG, e);
- }
- }
- // TODO: open InfoWindow
- }
- return false;
- }
-
- @Override
- public void onDragStart(Markup markup) {
- backendMap.setScrollGesturesEnabled(false);
- backendMap.setRotateGesturesEnabled(false);
- backendMap.setTiltGesturesEnabled(false);
- backendMap.setZoomGesturesEnabled(false);
- if (markup instanceof IMarkerDelegate) {
- if (onMarkerDragListener != null) {
- try {
- onMarkerDragListener.onMarkerDragStart((IMarkerDelegate) markup);
- } catch (RemoteException e) {
- Log.w(TAG, e);
- }
- }
- }
- }
-
- @Override
- public void onDragStop(Markup markup) {
- try {
- backendMap.setScrollGesturesEnabled(uiSettings.isScrollGesturesEnabled());
- backendMap.setRotateGesturesEnabled(uiSettings.isRotateGesturesEnabled());
- backendMap.setTiltGesturesEnabled(uiSettings.isTiltGesturesEnabled());
- backendMap.setZoomGesturesEnabled(uiSettings.isZoomGesturesEnabled());
- } catch (RemoteException e) {
- // Never happens, is local.
- }
- if (markup instanceof IMarkerDelegate) {
- if (onMarkerDragListener != null) {
- try {
- onMarkerDragListener.onMarkerDragEnd((IMarkerDelegate) markup);
- } catch (RemoteException e) {
- Log.w(TAG, e);
- }
- }
- }
- }
-
- @Override
- public void onDragProgress(Markup markup) {
- if (markup instanceof IMarkerDelegate) {
- if (onMarkerDragListener != null) {
- try {
- onMarkerDragListener.onMarkerDrag((IMarkerDelegate) markup);
- } catch (RemoteException e) {
- Log.w(TAG, e);
- }
- }
- }
- }
-
- /*
- Map options
- */
-
- @Override
- public int getMapType() throws RemoteException {
- return 0;
- }
-
- @Override
- public void setMapType(int type) throws RemoteException {
-
- }
-
- @Override
- public boolean isTrafficEnabled() throws RemoteException {
- return false;
- }
-
- @Override
- public void setTrafficEnabled(boolean traffic) throws RemoteException {
- Log.w(TAG, "Traffic not yet supported");
- }
-
- @Override
- public boolean isIndoorEnabled() throws RemoteException {
- return false;
- }
-
- @Override
- public void setIndoorEnabled(boolean indoor) throws RemoteException {
- Log.w(TAG, "Indoor not yet supported");
- }
-
- @Override
- public boolean isMyLocationEnabled() throws RemoteException {
- return false;
- }
-
- @Override
- public void setMyLocationEnabled(boolean myLocation) throws RemoteException {
- Log.w(TAG, "MyLocation not yet supported");
- boolean hasPermission = ContextCompat.checkSelfPermission(context, ACCESS_COARSE_LOCATION) == PERMISSION_GRANTED
- || ContextCompat.checkSelfPermission(context, ACCESS_FINE_LOCATION) == PERMISSION_GRANTED;
- if (!hasPermission) {
- throw new SecurityException("Neither " + ACCESS_COARSE_LOCATION + " nor " + ACCESS_FINE_LOCATION + " granted.");
- }
- LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
- if (myLocation) {
- locationManager.requestLocationUpdates(5000, 10, criteria, listener, Looper.getMainLooper());
- } else {
- locationManager.removeUpdates(listener);
- }
- }
-
- @Override
- public boolean isBuildingsEnabled() throws RemoteException {
- return backendMap.hasBuilding();
- }
-
- @Override
- public void setBuildingsEnabled(boolean buildingsEnabled) throws RemoteException {
- backendMap.setBuildings(buildingsEnabled);
- }
-
- /*
- Ui Settings
- */
-
- @Override
- public IUiSettingsDelegate getUiSettings() throws RemoteException {
- Log.d(TAG, "getUiSettings: " + uiSettings);
- return uiSettings;
- }
-
- @Override
- public void onUiSettingsChanged(UiSettingsImpl settings) throws RemoteException {
- if (settings.isCompassEnabled()) {
- Log.w(TAG, "Compass not yet supported");
- }
- if (settings.isMyLocationButtonEnabled()) {
- Log.w(TAG, "MyLocationButton not yet supported");
- }
- if (settings.isZoomControlsEnabled()) {
- Log.w(TAG, "ZoomControls not yet supported");
- }
- backendMap.setScrollGesturesEnabled(settings.isScrollGesturesEnabled());
- backendMap.setRotateGesturesEnabled(settings.isRotateGesturesEnabled());
- backendMap.setTiltGesturesEnabled(settings.isTiltGesturesEnabled());
- backendMap.setZoomGesturesEnabled(settings.isZoomGesturesEnabled());
- }
-
- /*
- Listener and callback setters
- */
-
- @Override
- public void setOnCameraChangeListener(IOnCameraChangeListener listener) throws RemoteException {
- Log.d(TAG, "setOnCameraChangeListener");
- this.onCameraChangeListener = listener;
- }
-
- @Override
- public void setOnMapClickListener(IOnMapClickListener listener) throws RemoteException {
- Log.d(TAG, "setOnMapClickListener: not supported");
- }
-
- @Override
- public void setOnMapLongClickListener(IOnMapLongClickListener listener) throws RemoteException {
- Log.d(TAG, "setOnMapLongClickListener: not supported");
- }
-
- @Override
- public void setOnMarkerClickListener(IOnMarkerClickListener listener) throws RemoteException {
- Log.d(TAG, "setOnMarkerClickListener");
- this.onMarkerClickListener = listener;
- }
-
- @Override
- public void setOnMarkerDragListener(IOnMarkerDragListener listener) throws RemoteException {
- Log.d(TAG, "setOnMarkerDragListener");
- this.onMarkerDragListener = listener;
- }
-
- @Override
- public void setOnInfoWindowClickListener(IOnInfoWindowClickListener listener)
- throws RemoteException {
- Log.d(TAG, "setOnInfoWindowClickListener: not supported");
- }
-
- @Override
- public void setOnMyLocationChangeListener(IOnMyLocationChangeListener listener)
- throws RemoteException {
- Log.d(TAG, "setOnMyLocationChangeListener");
- this.onMyLocationChangeListener = listener;
- }
-
- @Override
- public void setOnMyLocationButtonClickListener(IOnMyLocationButtonClickListener listener)
- throws RemoteException {
- Log.d(TAG, "setOnMyLocationButtonClickListener: not supported");
- }
-
- @Override
- public void setOnMapLoadedCallback(final IOnMapLoadedCallback callback) throws RemoteException {
- Log.d(TAG, "setOnMapLoadedCallback");
- new Handler(context.getMainLooper()).postDelayed(new Runnable() {
- @Override
- public void run() {
- Log.d(TAG, "Announce map loaded");
- if (callback != null) {
- try {
- callback.onMapLoaded();
- } catch (RemoteException e) {
- Log.w(TAG, e);
- }
- }
- }
- }, 5000);
- }
-
- @Override
- public void setWatermarkEnabled(boolean watermark) throws RemoteException {
- Log.d(TAG, "unimplemented Method: setWatermarkEnabled");
-
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) throws RemoteException {
- Log.d(TAG, "unimplemented Method: onCreate");
-
- }
-
- @Override
- public void setCameraMoveStartedListener(IOnCameraMoveStartedListener listener) throws RemoteException {
- Log.d(TAG, "unimplemented Method: setCameraMoveStartedListener");
-
- }
-
- @Override
- public void setCameraMoveListener(IOnCameraMoveListener listener) throws RemoteException {
- Log.d(TAG, "unimplemented Method: setCameraMoveListener");
-
- }
-
- @Override
- public void setCameraMoveCanceledListener(IOnCameraMoveCanceledListener listener) throws RemoteException {
- Log.d(TAG, "unimplemented Method: setCameraMoveCanceledListener");
-
- }
-
- @Override
- public void setCameraIdleListener(IOnCameraIdleListener listener) throws RemoteException {
- Log.d(TAG, "unimplemented Method: setCameraIdleListener");
-
- }
-
- @Override
- public void onStart() throws RemoteException {
- Log.d(TAG, "unimplemented Method: onStart");
-
- }
-
- @Override
- public void onStop() throws RemoteException {
- Log.d(TAG, "unimplemented Method: onStop");
-
- }
-
- /*
- Misc
- */
-
- @Override
- public IObjectWrapper getTestingHelper() throws RemoteException {
- return null;
- }
-
- @Override
- public void snapshot(ISnapshotReadyCallback callback, IObjectWrapper bitmap)
- throws RemoteException {
- Bitmap b = (Bitmap) ObjectWrapper.unwrap(bitmap);
- Log.d(TAG, "snapshot!: " + b);
- backendMap.snapshot(b, callback);
- }
-
- @Override
- public void setPadding(int left, int top, int right, int bottom) throws RemoteException {
- getView().setPadding(left, top, right, bottom);
- }
-
- @Override
- public Location getMyLocation() throws RemoteException {
- return myLocation;
- }
-
- @Override
- public void setLocationSource(ILocationSourceDelegate locationSource) throws RemoteException {
- Log.d(TAG, "setLocationSource: " + locationSource);
- }
-
- @Override
- public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
- if (super.onTransact(code, data, reply, flags)) return true;
- Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags);
- return false;
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/MapFragmentImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/MapFragmentImpl.java
deleted file mode 100644
index 44521532..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/MapFragmentImpl.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm;
-
-import android.app.Activity;
-import android.content.Context;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Parcel;
-import android.os.RemoteException;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import com.google.android.gms.dynamic.IObjectWrapper;
-import com.google.android.gms.dynamic.ObjectWrapper;
-import com.google.android.gms.maps.GoogleMapOptions;
-import com.google.android.gms.maps.internal.IGoogleMapDelegate;
-import com.google.android.gms.maps.internal.IMapFragmentDelegate;
-import com.google.android.gms.maps.internal.IOnMapReadyCallback;
-
-public class MapFragmentImpl extends IMapFragmentDelegate.Stub {
- private static final String TAG = "GmsMapFragImpl";
-
- private GoogleMapImpl map;
- private GoogleMapOptions options;
- private Activity activity;
-
- public MapFragmentImpl(Activity activity) {
- this.activity = activity;
- }
-
- private GoogleMapImpl myMap() {
- if (map == null) {
- Log.d(TAG, "GoogleMap instance created");
- LayoutInflater inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- map = GoogleMapImpl.create(inflater.getContext(), options);
- }
- return map;
- }
-
- @Override
- public IGoogleMapDelegate getMap() throws RemoteException {
- Log.d(TAG, "getMap");
- return myMap();
- }
-
- @Override
- public void onInflate(IObjectWrapper activity, GoogleMapOptions options,
- Bundle savedInstanceState) throws RemoteException {
- if (options != null) this.options = options;
- Log.d(TAG, "onInflate");
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) throws RemoteException {
- Log.d(TAG, "onCreate");
- //myMap().onCreate(savedInstanceState);
- // TOOD: Certainly does not belong here and this way
- Bundle mapState = savedInstanceState.getBundle("map_state");
- if (mapState != null) {
- mapState.setClassLoader(GoogleMapOptions.class.getClassLoader());
- GoogleMapOptions options = mapState.getParcelable("MapOptions");
- if (options != null) this.options = options;
- }
- }
-
- @Override
- public IObjectWrapper onCreateView(IObjectWrapper layoutInflater, IObjectWrapper container,
- Bundle savedInstanceState) throws RemoteException {
- Log.d(TAG, "onCreateView");
- if (map == null) {
- LayoutInflater inflater = (LayoutInflater) ObjectWrapper.unwrap(layoutInflater);
- map = GoogleMapImpl.create(inflater.getContext(), options);
- //map.onCreate(savedInstanceState);
- } else {
- View view = map.getView();
- if (view.getParent() instanceof ViewGroup) {
- ((ViewGroup) view.getParent()).removeView(view);
- }
- }
- return ObjectWrapper.wrap(myMap().getView());
- }
-
- @Override
- public void onResume() throws RemoteException {
- Log.d(TAG, "onResume");
- myMap().onResume();
- }
-
- @Override
- public void onPause() throws RemoteException {
- Log.d(TAG, "onPause");
- myMap().onPause();
- }
-
- @Override
- public void onDestroyView() throws RemoteException {
- Log.d(TAG, "onDestroyView");
- }
-
- @Override
- public void onDestroy() throws RemoteException {
- Log.d(TAG, "onDestroy");
- myMap().onDestroy();
- }
-
- @Override
- public void onLowMemory() throws RemoteException {
- Log.d(TAG, "onLowMemory");
- }
-
- @Override
- public void onEnterAmbient(Bundle bundle) throws RemoteException {
- map.onEnterAmbient(bundle);
- }
-
- @Override
- public void onExitAmbient() throws RemoteException {
- map.onExitAmbient();
- }
-
- @Override
- public void onStart() throws RemoteException {
- map.onStart();
- }
-
- @Override
- public void onStop() throws RemoteException {
- map.onStop();
- }
-
- @Override
- public void onSaveInstanceState(Bundle outState) throws RemoteException {
- Log.d(TAG, "onSaveInstanceState: " + outState);
- //myMap().onSaveInstanceState(outState);
- }
-
- @Override
- public boolean isReady() throws RemoteException {
- Log.d(TAG, "isReady");
- return map != null;
- }
-
- @Override
- public void getMapAsync(final IOnMapReadyCallback callback) throws RemoteException {
- new Handler(activity.getMainLooper()).post(new Runnable() {
- @Override
- public void run() {
- try {
- callback.onMapReady(myMap());
- } catch (RemoteException e) {
- Log.w(TAG, e);
- }
- }
- });
- }
-
- @Override
- public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
- if (super.onTransact(code, data, reply, flags)) return true;
- Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags);
- return false;
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/MapViewImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/MapViewImpl.java
deleted file mode 100644
index c24ea52e..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/MapViewImpl.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm;
-
-import android.content.Context;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Parcel;
-import android.os.RemoteException;
-import android.util.Log;
-import android.view.LayoutInflater;
-
-import com.google.android.gms.dynamic.IObjectWrapper;
-import com.google.android.gms.dynamic.ObjectWrapper;
-import com.google.android.gms.maps.GoogleMapOptions;
-import com.google.android.gms.maps.internal.IGoogleMapDelegate;
-import com.google.android.gms.maps.internal.IMapViewDelegate;
-import com.google.android.gms.maps.internal.IOnMapReadyCallback;
-
-public class MapViewImpl extends IMapViewDelegate.Stub {
- private static final String TAG = "GmsMapViewImpl";
-
- private GoogleMapImpl map;
- private GoogleMapOptions options;
- private Context context;
- private IOnMapReadyCallback readyCallback;
-
- public MapViewImpl(Context context, GoogleMapOptions options) {
- this.context = context;
- this.options = options;
- }
-
- private GoogleMapImpl myMap() {
- if (map == null) {
- Log.d(TAG, "GoogleMap instance created");
- LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- map = GoogleMapImpl.create(inflater.getContext(), options);
- }
- return map;
- }
-
- @Override
- public IGoogleMapDelegate getMap() throws RemoteException {
- Log.d(TAG, "getMap");
- return myMap();
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) throws RemoteException {
- //myMap().onCreate(savedInstanceState);
- Log.d(TAG, "onCreate");
- }
-
- @Override
- public void onResume() throws RemoteException {
- Log.d(TAG, "onResume");
-
- myMap().onResume();
- if (readyCallback != null) {
- try {
- readyCallback.onMapReady(map);
- readyCallback = null;
- } catch (Exception e) {
- Log.w(TAG, e);
- }
- }
- }
-
- @Override
- public void onPause() throws RemoteException {
- Log.d(TAG, "onPause");
- myMap().onPause();
- }
-
- @Override
- public void onDestroy() throws RemoteException {
- Log.d(TAG, "onDestroy");
- myMap().onDestroy();
- }
-
- @Override
- public void onLowMemory() throws RemoteException {
- Log.d(TAG, "onLowMemory");
- }
-
- @Override
- public void onSaveInstanceState(Bundle outState) throws RemoteException {
- Log.d(TAG, "onSaveInstanceState: " + outState);
- }
-
- @Override
- public IObjectWrapper getView() throws RemoteException {
- return ObjectWrapper.wrap(myMap().getView());
- }
-
- @Override
- public void getMapAsync(final IOnMapReadyCallback callback) throws RemoteException {
- Log.d(TAG, "getMapAsync");
- new Handler(context.getMainLooper()).post(new Runnable() {
- @Override
- public void run() {
- try {
- callback.onMapReady(myMap());
- } catch (RemoteException e) {
- Log.w(TAG, e);
- }
- }
- });
- }
-
- @Override
- public void onEnterAmbient(Bundle bundle) throws RemoteException {
- map.onEnterAmbient(bundle);
- }
-
- @Override
- public void onExitAmbient() throws RemoteException {
- map.onExitAmbient();
- }
-
- @Override
- public void onStart() throws RemoteException {
- map.onStart();
- }
-
- @Override
- public void onStop() throws RemoteException {
- map.onStop();
- }
-
- @Override
- public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
- if (super.onTransact(code, data, reply, flags)) return true;
- Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags);
- return false;
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ProjectionImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ProjectionImpl.java
deleted file mode 100644
index f6fa1954..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ProjectionImpl.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm;
-
-import android.os.RemoteException;
-
-import com.google.android.gms.dynamic.IObjectWrapper;
-import com.google.android.gms.dynamic.ObjectWrapper;
-import com.google.android.gms.maps.internal.IProjectionDelegate;
-import com.google.android.gms.maps.model.LatLng;
-import com.google.android.gms.maps.model.VisibleRegion;
-
-import org.oscim.core.Point;
-import org.oscim.map.Viewport;
-
-public class ProjectionImpl extends IProjectionDelegate.Stub {
- private Viewport viewport;
- private float[] extents = new float[8];
-
- public ProjectionImpl(Viewport viewport) {
- this.viewport = viewport;
- }
-
- @Override
- public LatLng fromScreenLocation(IObjectWrapper obj) throws RemoteException {
- Point point = GmsMapsTypeHelper
- .fromPoint((android.graphics.Point) ObjectWrapper.unwrap(obj));
- return GmsMapsTypeHelper
- .toLatLng(viewport.fromScreenPoint((float) point.x, (float) point.y));
- }
-
- @Override
- public IObjectWrapper toScreenLocation(LatLng latLng) throws RemoteException {
- Point point = new Point();
- viewport.toScreenPoint(GmsMapsTypeHelper.fromLatLng(latLng), point);
- return ObjectWrapper.wrap(GmsMapsTypeHelper.toPoint(point));
- }
-
- @Override
- public VisibleRegion getVisibleRegion() throws RemoteException {
- viewport.getMapExtents(extents, 0);
- // TODO: Support non-flat map extents
- return new VisibleRegion(GmsMapsTypeHelper.toLatLngBounds(viewport.getBBox(null, 0)));
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ResourcesContainer.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ResourcesContainer.java
deleted file mode 100644
index ab53e7e5..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/ResourcesContainer.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm;
-
-import android.content.res.Resources;
-
-public class ResourcesContainer {
- private static Resources resources;
-
- public static void set(Resources resources) {
- ResourcesContainer.resources = resources;
- }
-
- public static Resources get() {
- if (resources == null) {
- throw new IllegalStateException("Resources have not been initialized");
- } else {
- return resources;
- }
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/UiSettingsImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/UiSettingsImpl.java
deleted file mode 100644
index cb24de3c..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/UiSettingsImpl.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (C) 2019 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm;
-
-import android.os.RemoteException;
-import com.google.android.gms.maps.internal.IUiSettingsDelegate;
-
-public class UiSettingsImpl extends IUiSettingsDelegate.Stub {
- private boolean zoomControlsEnabled;
- private boolean compassEnabled;
- private boolean myLocationButtonEnabled;
- private boolean scrollGesturesEnabled = true;
- private boolean zoomGesturesEnabled = true;
- private boolean tiltGesturesEnabled = true;
- private boolean rotateGesturesEnabled = true;
- private boolean allGesturesEnabled = true;
- private boolean indoorLevelPickerEnabled = false;
- private boolean mapToolbarEnabled = false;
- private boolean scrollGesturesEnabledDuringRotateOrZoom = true;
-
- private UiSettingsListener listener;
-
- public UiSettingsImpl() {
- }
-
- public UiSettingsImpl(UiSettingsListener listener) {
- this.listener = listener;
- }
-
- public void setListener(UiSettingsListener listener) {
- this.listener = listener;
- }
-
- @Override
- public void setZoomControlsEnabled(boolean zoomControlsEnabled) throws RemoteException {
- this.zoomControlsEnabled = zoomControlsEnabled;
- listener.onUiSettingsChanged(this);
- }
-
- @Override
- public void setCompassEnabled(boolean compassEnabled) throws RemoteException {
- this.compassEnabled = compassEnabled;
- listener.onUiSettingsChanged(this);
- }
-
- @Override
- public void setMyLocationButtonEnabled(boolean myLocationButtonEnabled) throws RemoteException {
- this.myLocationButtonEnabled = myLocationButtonEnabled;
- listener.onUiSettingsChanged(this);
- }
-
- @Override
- public void setScrollGesturesEnabled(boolean scrollGesturesEnabled) throws RemoteException {
- this.scrollGesturesEnabled = scrollGesturesEnabled;
- listener.onUiSettingsChanged(this);
- }
-
- @Override
- public void setZoomGesturesEnabled(boolean zoomGestures) throws RemoteException {
- this.zoomGesturesEnabled = zoomGestures;
- listener.onUiSettingsChanged(this);
- }
-
- @Override
- public void setTiltGesturesEnabled(boolean tiltGesturesEnabled) throws RemoteException {
- this.tiltGesturesEnabled = tiltGesturesEnabled;
- listener.onUiSettingsChanged(this);
- }
-
- @Override
- public void setRotateGesturesEnabled(boolean rotateGesturesEnabled) throws RemoteException {
- this.rotateGesturesEnabled = rotateGesturesEnabled;
- listener.onUiSettingsChanged(this);
- }
-
- @Override
- public void setAllGesturesEnabled(boolean gestures) throws RemoteException {
- scrollGesturesEnabled = gestures;
- zoomGesturesEnabled = gestures;
- tiltGesturesEnabled = gestures;
- rotateGesturesEnabled = gestures;
- listener.onUiSettingsChanged(this);
- }
-
- @Override
- public boolean isZoomControlsEnabled() throws RemoteException {
- return zoomControlsEnabled;
- }
-
- @Override
- public boolean isCompassEnabled() throws RemoteException {
- return compassEnabled;
- }
-
- @Override
- public boolean isMyLocationButtonEnabled() throws RemoteException {
- return myLocationButtonEnabled;
- }
-
- @Override
- public boolean isScrollGesturesEnabled() throws RemoteException {
- return scrollGesturesEnabled;
- }
-
- @Override
- public boolean isZoomGesturesEnabled() throws RemoteException {
- return zoomGesturesEnabled;
- }
-
- @Override
- public boolean isTiltGesturesEnabled() throws RemoteException {
- return tiltGesturesEnabled;
- }
-
- @Override
- public boolean isRotateGesturesEnabled() throws RemoteException {
- return rotateGesturesEnabled;
- }
-
- @Override
- public void setIndoorLevelPickerEnabled(boolean indoorLevelPicker) throws RemoteException {
- this.indoorLevelPickerEnabled = indoorLevelPicker;
- listener.onUiSettingsChanged(this);
- }
-
- @Override
- public boolean isIndoorLevelPickerEnabled() throws RemoteException {
- return indoorLevelPickerEnabled;
- }
-
- @Override
- public void setMapToolbarEnabled(boolean mapToolbar) throws RemoteException {
- this.mapToolbarEnabled = mapToolbar;
- listener.onUiSettingsChanged(this);
- }
-
- @Override
- public boolean isMapToolbarEnabled() throws RemoteException {
- return mapToolbarEnabled;
- }
-
- @Override
- public void setScrollGesturesEnabledDuringRotateOrZoom(boolean scrollDuringZoom) throws RemoteException {
- this.scrollGesturesEnabledDuringRotateOrZoom = scrollDuringZoom;
- listener.onUiSettingsChanged(this);
- }
-
- @Override
- public boolean isScrollGesturesEnabledDuringRotateOrZoom() throws RemoteException {
- return scrollGesturesEnabledDuringRotateOrZoom;
- }
-
- public static interface UiSettingsListener {
- void onUiSettingsChanged(UiSettingsImpl settings) throws RemoteException;
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/AbstractBitmapDescriptor.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/AbstractBitmapDescriptor.java
deleted file mode 100644
index 92cee1c1..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/AbstractBitmapDescriptor.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.bitmap;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-
-public abstract class AbstractBitmapDescriptor {
-
- private Bitmap bitmap;
-
- protected abstract Bitmap generateBitmap(Context context);
-
- public Bitmap loadBitmap(Context context) {
- if (bitmap == null) {
- synchronized (this) {
- if (bitmap == null)
- bitmap = generateBitmap(context);
- }
- }
- return bitmap;
- }
-
- public Bitmap getBitmap() {
- return bitmap;
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/AssetBitmapDescriptor.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/AssetBitmapDescriptor.java
deleted file mode 100644
index 80070321..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/AssetBitmapDescriptor.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.bitmap;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-
-import java.io.IOException;
-
-public class AssetBitmapDescriptor extends AbstractBitmapDescriptor {
- private String assetName;
-
- public AssetBitmapDescriptor(String assetName) {
- this.assetName = assetName;
- }
-
- @Override
- protected Bitmap generateBitmap(Context context) {
- try {
- return BitmapFactory.decodeStream(context.getAssets().open(assetName));
- } catch (IOException e) {
- e.printStackTrace();
- }
- return null;
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/BitmapBitmapDescriptor.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/BitmapBitmapDescriptor.java
deleted file mode 100644
index 6ccce321..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/BitmapBitmapDescriptor.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.bitmap;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-
-public class BitmapBitmapDescriptor extends AbstractBitmapDescriptor {
- private Bitmap bitmap;
-
- public BitmapBitmapDescriptor(Bitmap bitmap) {
- this.bitmap = bitmap;
- }
-
- @Override
- public Bitmap getBitmap() {
- return bitmap;
- }
-
- @Override
- public Bitmap generateBitmap(Context context) {
- return bitmap;
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/BitmapDescriptorFactoryImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/BitmapDescriptorFactoryImpl.java
deleted file mode 100644
index e5374a62..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/BitmapDescriptorFactoryImpl.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.bitmap;
-
-import android.graphics.Bitmap;
-import android.os.Parcel;
-import android.os.RemoteException;
-import android.util.Log;
-
-import com.google.android.gms.dynamic.IObjectWrapper;
-import com.google.android.gms.dynamic.ObjectWrapper;
-import com.google.android.gms.maps.model.internal.IBitmapDescriptorFactoryDelegate;
-
-public class BitmapDescriptorFactoryImpl extends IBitmapDescriptorFactoryDelegate.Stub {
- private static final String TAG = "GmsBitmapDescFactory";
-
- @Override
- public IObjectWrapper fromResource(int resourceId) throws RemoteException {
- return ObjectWrapper.wrap(new ResourceBitmapDescriptor(resourceId));
- }
-
- @Override
- public IObjectWrapper fromAsset(String assetName) throws RemoteException {
- return ObjectWrapper.wrap(new AssetBitmapDescriptor(assetName));
- }
-
- @Override
- public IObjectWrapper fromFile(String fileName) throws RemoteException {
- return ObjectWrapper.wrap(new FileBitmapDescriptor(fileName));
- }
-
- @Override
- public IObjectWrapper defaultMarker() throws RemoteException {
- return ObjectWrapper.wrap(DefaultBitmapDescriptor.DEFAULT_DESCRIPTOR);
- }
-
- @Override
- public IObjectWrapper defaultMarkerWithHue(float hue) throws RemoteException {
- return ObjectWrapper.wrap(new DefaultBitmapDescriptor(hue));
- }
-
- @Override
- public IObjectWrapper fromBitmap(Bitmap bitmap) throws RemoteException {
- return ObjectWrapper.wrap(new BitmapBitmapDescriptor(bitmap));
- }
-
- @Override
- public IObjectWrapper fromPath(String absolutePath) throws RemoteException {
- return ObjectWrapper.wrap(new PathBitmapDescriptor(absolutePath));
- }
-
- @Override
- public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
- if (super.onTransact(code, data, reply, flags)) return true;
- Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags);
- return false;
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/BitmapDescriptorImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/BitmapDescriptorImpl.java
deleted file mode 100644
index dc12072d..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/BitmapDescriptorImpl.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.bitmap;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.util.Log;
-
-import com.google.android.gms.dynamic.IObjectWrapper;
-import com.google.android.gms.dynamic.ObjectWrapper;
-import com.google.android.gms.maps.model.BitmapDescriptor;
-
-import java.util.HashSet;
-import java.util.Set;
-
-public class BitmapDescriptorImpl {
- private BitmapDescriptor descriptor;
- private boolean loadStarted = false;
- private Set waitingForLoad = new HashSet();
-
- public BitmapDescriptorImpl(IObjectWrapper remoteObject) {
- this(new BitmapDescriptor(remoteObject));
- }
-
- public BitmapDescriptorImpl(BitmapDescriptor descriptor) {
- this.descriptor = descriptor;
- }
-
- public BitmapDescriptorImpl() {
- this(new ObjectWrapper(new DefaultBitmapDescriptor(0)));
- }
-
- public AbstractBitmapDescriptor getDescriptor() {
- if (descriptor.getRemoteObject() == null)
- return null;
- Object unwrap = ObjectWrapper.unwrap(descriptor.getRemoteObject());
- if (unwrap instanceof AbstractBitmapDescriptor) {
- return ((AbstractBitmapDescriptor) unwrap);
- } else {
- return null;
- }
- }
-
- public Bitmap getBitmap() {
- if (getDescriptor() != null) {
- return getDescriptor().getBitmap();
- }
- return null;
- }
-
- public synchronized boolean loadBitmapAsync(final Context context, Runnable after) {
- if (getBitmap() != null) {
- return false;
- }
- waitingForLoad.add(after);
- if (loadStarted)
- return true;
- loadStarted = true;
- if (getDescriptor() != null) {
- new Thread(new Runnable() {
- @Override
- public void run() {
- Log.d("BitmapDescriptor", "Start loading " + getDescriptor());
- if (getDescriptor().loadBitmap(context) != null) {
- Set waitingForLoad;
- synchronized (BitmapDescriptorImpl.this) {
- waitingForLoad = BitmapDescriptorImpl.this.waitingForLoad;
- }
- for (Runnable after : waitingForLoad) {
- after.run();
- }
- }
- Log.d("BitmapDescriptor", "Done loading " + getDescriptor());
- }
- }).start();
- }
- return true;
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/DefaultBitmapDescriptor.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/DefaultBitmapDescriptor.java
deleted file mode 100644
index 340548c5..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/DefaultBitmapDescriptor.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.bitmap;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Canvas;
-import android.graphics.ColorFilter;
-import android.graphics.ColorMatrix;
-import android.graphics.ColorMatrixColorFilter;
-import android.graphics.Paint;
-
-import com.google.android.gms.dynamic.ObjectWrapper;
-
-import org.microg.gms.maps.vtm.ResourcesContainer;
-import org.microg.gms.maps.vtm.R;
-
-public class DefaultBitmapDescriptor extends AbstractBitmapDescriptor {
- public static final DefaultBitmapDescriptor DEFAULT_DESCRIPTOR = new DefaultBitmapDescriptor(0);
- public static final BitmapDescriptorImpl DEFAULT_DESCRIPTOR_IMPL = new BitmapDescriptorImpl(ObjectWrapper.wrap(DEFAULT_DESCRIPTOR));
- public static final int DEGREES = 360;
-
- private final float hue;
-
- public DefaultBitmapDescriptor(float hue) {
- this.hue = hue > 180 ? -DEGREES + hue : hue;
- }
-
- @Override
- public Bitmap generateBitmap(Context context) {
- Bitmap source;
- if (this == DEFAULT_DESCRIPTOR) {
- source = BitmapFactory.decodeResource(ResourcesContainer.get(), R.drawable.maps_default_marker);
- } else {
- source = DEFAULT_DESCRIPTOR.loadBitmap(context);
- }
- if (hue % DEGREES == 0) return source;
- Paint paint = new Paint();
- paint.setColorFilter(adjustHue(hue));
- Bitmap bitmap = Bitmap.createBitmap(source.getWidth(), source.getHeight(), source.getConfig());
- Canvas canvas = new Canvas(bitmap);
- canvas.drawBitmap(source, 0, 0, paint);
- return bitmap;
- }
-
- /**
- * Creates a HUE ajustment ColorFilter
- *
- * see http://groups.google.com/group/android-developers/browse_thread/thread/9e215c83c3819953
- * see http://gskinner.com/blog/archives/2007/12/colormatrix_cla.html
- *
- * @param value degrees to shift the hue.
- */
- public static ColorFilter adjustHue(float value) {
- ColorMatrix cm = new ColorMatrix();
- adjustHue(cm, value);
- return new ColorMatrixColorFilter(cm);
- }
-
- /**
- * see http://groups.google.com/group/android-developers/browse_thread/thread/9e215c83c3819953
- * see http://gskinner.com/blog/archives/2007/12/colormatrix_cla.html
- */
- public static void adjustHue(ColorMatrix cm, float value) {
- value = cleanValue(value, 180f) / 180f * (float) Math.PI;
- if (value == 0) {
- return;
- }
- float cosVal = (float) Math.cos(value);
- float sinVal = (float) Math.sin(value);
- float lumR = 0.213f;
- float lumG = 0.715f;
- float lumB = 0.072f;
- float[] mat = new float[]{lumR + cosVal * (1 - lumR) + sinVal * (-lumR),
- lumG + cosVal * (-lumG) + sinVal * (-lumG),
- lumB + cosVal * (-lumB) + sinVal * (1 - lumB), 0, 0,
- lumR + cosVal * (-lumR) + sinVal * (0.143f),
- lumG + cosVal * (1 - lumG) + sinVal * (0.140f),
- lumB + cosVal * (-lumB) + sinVal * (-0.283f), 0, 0,
- lumR + cosVal * (-lumR) + sinVal * (-(1 - lumR)),
- lumG + cosVal * (-lumG) + sinVal * (lumG),
- lumB + cosVal * (1 - lumB) + sinVal * (lumB),
- 0, 0, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 0f, 1f};
- cm.postConcat(new ColorMatrix(mat));
- }
-
- protected static float cleanValue(float p_val, float p_limit) {
- return Math.min(p_limit, Math.max(-p_limit, p_val));
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/FileBitmapDescriptor.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/FileBitmapDescriptor.java
deleted file mode 100644
index 6b109b50..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/FileBitmapDescriptor.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.bitmap;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-
-public class FileBitmapDescriptor extends AbstractBitmapDescriptor {
- private String fileName;
-
- public FileBitmapDescriptor(String fileName) {
- this.fileName = fileName;
- }
-
- @Override
- public Bitmap generateBitmap(Context context) {
- return BitmapFactory.decodeFile(fileName);
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/PathBitmapDescriptor.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/PathBitmapDescriptor.java
deleted file mode 100644
index 46ad1aa0..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/PathBitmapDescriptor.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.bitmap;
-
-public class PathBitmapDescriptor {
- public PathBitmapDescriptor(String absolutePath) {
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/ResourceBitmapDescriptor.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/ResourceBitmapDescriptor.java
deleted file mode 100644
index d06f38a0..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/bitmap/ResourceBitmapDescriptor.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.bitmap;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-
-import androidx.core.content.ContextCompat;
-
-public class ResourceBitmapDescriptor extends AbstractBitmapDescriptor {
- private int resourceId;
-
- public ResourceBitmapDescriptor(int resourceId) {
- this.resourceId = resourceId;
- }
-
- @Override
- public Bitmap generateBitmap(Context context) {
- return drawableToBitmap(context, ContextCompat.getDrawable(context.getApplicationContext(), resourceId));
- }
-
- public static Bitmap drawableToBitmap(Context context, Drawable drawable) {
- if (drawable instanceof BitmapDrawable) {
- return ((BitmapDrawable) drawable).getBitmap();
- }
-
- if (drawable.getIntrinsicWidth() <= 0 || drawable.getIntrinsicHeight() <= 0) {
- return DefaultBitmapDescriptor.DEFAULT_DESCRIPTOR.loadBitmap(context);
- }
-
- Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
- Canvas canvas = new Canvas(bitmap);
- drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
- drawable.draw(canvas);
-
- return bitmap;
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/CameraUpdate.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/CameraUpdate.java
deleted file mode 100644
index 69639bcc..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/CameraUpdate.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.camera;
-
-import org.oscim.map.Map;
-
-public interface CameraUpdate {
- void apply(Map map);
- void applyAnimated(Map map, int duration);
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/CameraUpdateFactoryImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/CameraUpdateFactoryImpl.java
deleted file mode 100644
index 17020a86..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/CameraUpdateFactoryImpl.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.camera;
-
-import android.os.RemoteException;
-import android.util.Log;
-
-import com.google.android.gms.dynamic.IObjectWrapper;
-import com.google.android.gms.dynamic.ObjectWrapper;
-import com.google.android.gms.maps.internal.ICameraUpdateFactoryDelegate;
-import com.google.android.gms.maps.model.CameraPosition;
-import com.google.android.gms.maps.model.LatLng;
-import com.google.android.gms.maps.model.LatLngBounds;
-
-import org.microg.gms.maps.vtm.GmsMapsTypeHelper;
-import org.oscim.core.MapPosition;
-import org.oscim.map.Map;
-
-public class CameraUpdateFactoryImpl extends ICameraUpdateFactoryDelegate.Stub {
- private static final String TAG = "GmsMapCamUpdateFactory";
-
- private CameraUpdateFactoryImpl() {
-
- }
-
- private static CameraUpdateFactoryImpl instance;
- public static CameraUpdateFactoryImpl get() {
- if (instance == null) {
- instance = new CameraUpdateFactoryImpl();
- }
- return instance;
- }
-
- @Override
- public IObjectWrapper zoomIn() throws RemoteException {
- Log.d(TAG, "zoomIn");
- return new ObjectWrapper(new MapPositionCameraUpdate() {
-
- @Override
- MapPosition getMapPosition(Map map) {
- MapPosition mapPosition = map.getMapPosition();
- mapPosition.setScale(GmsMapsTypeHelper.fromZoom(
- GmsMapsTypeHelper.toZoom(mapPosition.getScale()) + 1));
- return mapPosition;
- }
- });
- }
-
- @Override
- public IObjectWrapper zoomOut() throws RemoteException {
- Log.d(TAG, "zoomOut");
- return new ObjectWrapper(new MapPositionCameraUpdate() {
- @Override
- MapPosition getMapPosition(Map map) {
- MapPosition mapPosition = map.getMapPosition();
- mapPosition.setScale(GmsMapsTypeHelper.fromZoom(
- GmsMapsTypeHelper.toZoom(mapPosition.getScale()) - 1));
- return mapPosition;
- }
- });
- }
-
- @Override
- public IObjectWrapper scrollBy(final float x, final float y) throws RemoteException {
- Log.d(TAG, "scrollBy");
- return new ObjectWrapper(new MapPositionCameraUpdate() {
- @Override
- MapPosition getMapPosition(Map map) {
- MapPosition mapPosition = map.getMapPosition();
- mapPosition.setPosition(map.viewport()
- .fromScreenPoint((float) (map.getWidth() / 2.0 + x),
- (float) (map.getHeight() / 2.0 + y)));
- return mapPosition;
- }
- });
- }
-
- @Override
- public IObjectWrapper zoomTo(final float zoom) throws RemoteException {
- Log.d(TAG, "zoomTo");
- return new ObjectWrapper(new MapPositionCameraUpdate() {
- @Override
- MapPosition getMapPosition(Map map) {
- MapPosition mapPosition = map.getMapPosition();
- mapPosition.setScale(GmsMapsTypeHelper.fromZoom(zoom));
- return mapPosition;
- }
- });
- }
-
- @Override
- public IObjectWrapper zoomBy(final float zoomDelta) throws RemoteException {
- Log.d(TAG, "zoomBy");
- return new ObjectWrapper(new MapPositionCameraUpdate() {
- @Override
- MapPosition getMapPosition(Map map) {
- MapPosition mapPosition = map.getMapPosition();
- mapPosition.setScale(GmsMapsTypeHelper.fromZoom(
- GmsMapsTypeHelper.toZoom(mapPosition.getScale()) + zoomDelta));
- return mapPosition;
- }
- });
- }
-
- @Override
- public IObjectWrapper zoomByWithFocus(final float zoomDelta, int x, int y)
- throws RemoteException {
- Log.d(TAG, "zoomByWithFocus");
- return new ObjectWrapper(new MapPositionCameraUpdate() {
- @Override
- MapPosition getMapPosition(Map map) {
- MapPosition mapPosition = map.getMapPosition();
- mapPosition.setScale(GmsMapsTypeHelper.fromZoom(
- GmsMapsTypeHelper.toZoom(mapPosition.getScale()) + zoomDelta));
- Log.w(TAG, "zoomBy with focus not yet supported"); // TODO
- return mapPosition;
- }
- });
- }
-
- @Override
- public IObjectWrapper newCameraPosition(final CameraPosition cameraPosition)
- throws RemoteException {
- Log.d(TAG, "newCameraPosition");
- return new ObjectWrapper(new MapPositionCameraUpdate() {
- @Override
- MapPosition getMapPosition(Map map) {
- return GmsMapsTypeHelper.fromCameraPosition(cameraPosition);
- }
- });
- }
-
- @Override
- public IObjectWrapper newLatLng(final LatLng latLng) throws RemoteException {
- Log.d(TAG, "newLatLng");
- return new ObjectWrapper(new MapPositionCameraUpdate() {
- @Override
- MapPosition getMapPosition(Map map) {
- MapPosition mapPosition = map.getMapPosition();
- mapPosition.setPosition(GmsMapsTypeHelper.fromLatLng(latLng));
- return mapPosition;
- }
- });
- }
-
- @Override
- public IObjectWrapper newLatLngZoom(final LatLng latLng, final float zoom)
- throws RemoteException {
- Log.d(TAG, "newLatLngZoom");
- return new ObjectWrapper(new MapPositionCameraUpdate() {
- @Override
- MapPosition getMapPosition(Map map) {
- MapPosition mapPosition = map.getMapPosition();
- mapPosition.setPosition(GmsMapsTypeHelper.fromLatLng(latLng));
- mapPosition.setScale(GmsMapsTypeHelper.fromZoom(zoom));
- return mapPosition;
- }
- });
- }
-
- @Override
- public IObjectWrapper newLatLngBounds(final LatLngBounds bounds, int padding) throws RemoteException {
- Log.d(TAG, "newLatLngBounds");
- return new ObjectWrapper(new MapPositionCameraUpdate() {
- @Override
- MapPosition getMapPosition(Map map) {
- MapPosition mapPosition = map.getMapPosition();
- mapPosition.setByBoundingBox(GmsMapsTypeHelper.fromLatLngBounds(bounds),
- map.getWidth(), map.getHeight());
- return mapPosition;
- }
- });
- }
-
- @Override
- public IObjectWrapper newLatLngBoundsWithSize(final LatLngBounds bounds, final int width, final int height, int padding)
- throws RemoteException {
- Log.d(TAG, "newLatLngBoundsWithSize");
- return new ObjectWrapper(new MapPositionCameraUpdate() {
- @Override
- MapPosition getMapPosition(Map map) {
- MapPosition mapPosition = map.getMapPosition();
- mapPosition.setByBoundingBox(GmsMapsTypeHelper.fromLatLngBounds(bounds),
- width, height);
- return mapPosition;
- }
- });
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/MapPositionCameraUpdate.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/MapPositionCameraUpdate.java
deleted file mode 100644
index fa5ebce2..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/MapPositionCameraUpdate.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.camera;
-
-import org.oscim.core.MapPosition;
-import org.oscim.map.Map;
-
-public abstract class MapPositionCameraUpdate implements CameraUpdate {
-
- abstract MapPosition getMapPosition(Map map);
-
- @Override
- public void apply(Map map) {
- map.setMapPosition(getMapPosition(map));
- }
-
- @Override
- public void applyAnimated(Map map, int duration) {
- map.animator().animateTo(duration, getMapPosition(map));
- }
-
- public static CameraUpdate directMapPosition(final MapPosition position) {
- return new MapPositionCameraUpdate() {
- @Override
- MapPosition getMapPosition(Map map) {
- return position;
- }
- };
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/NoCameraUpdate.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/NoCameraUpdate.java
deleted file mode 100644
index a24a6d22..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/camera/NoCameraUpdate.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.camera;
-
-import org.oscim.map.Map;
-
-public class NoCameraUpdate implements CameraUpdate {
- @Override
- public void apply(Map map) {
-
- }
-
- @Override
- public void applyAnimated(Map map, int duration) {
-
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/data/SharedTileCache.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/data/SharedTileCache.java
deleted file mode 100644
index 3cdd61eb..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/data/SharedTileCache.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.data;
-
-import android.content.ContentValues;
-import android.content.Context;
-import android.database.Cursor;
-
-import org.oscim.core.Tile;
-import org.oscim.tiling.ITileCache;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-
-public class SharedTileCache implements ITileCache {
- private final ArrayList cacheBuffers;
- private final Context context;
-
- public SharedTileCache(Context context) {
- this.context = context;
- this.cacheBuffers = new ArrayList();
- }
-
- @Override
- public TileWriter writeTile(Tile tile) {
- ByteArrayOutputStream os;
- synchronized (this.cacheBuffers) {
- if (this.cacheBuffers.isEmpty()) {
- os = new ByteArrayOutputStream('耀');
- } else {
- os = this.cacheBuffers.remove(this.cacheBuffers.size() - 1);
- }
- }
-
- return new CacheTileWriter(tile, os);
- }
-
- public void saveTile(Tile tile, ByteArrayOutputStream data, boolean success) {
- byte[] bytes = null;
- if (success) {
- bytes = data.toByteArray();
- }
-
- synchronized (this.cacheBuffers) {
- data.reset();
- this.cacheBuffers.add(data);
- }
-
- if (success) {
- ContentValues values = new ContentValues();
- values.put("x", tile.tileX);
- values.put("y", tile.tileY);
- values.put("z", tile.zoomLevel);
- values.put("time", 0);
- values.put("last_access", 0);
- values.put("data", bytes);
- context.getContentResolver().insert(SharedTileProvider.PROVIDER_URI, values);
- }
- }
-
- @Override
- public TileReader getTile(Tile tile) {
- Cursor cursor = context.getContentResolver().query(SharedTileProvider.PROVIDER_URI, new String[]{"data"}, "z=? AND x=? AND y=?", new String[]{String.valueOf(tile.zoomLevel), String.valueOf(tile.tileX), String.valueOf(tile.tileY)}, null);
- if (cursor != null) {
- if (!cursor.moveToFirst()) {
- cursor.close();
- return null;
- } else {
- ByteArrayInputStream in = new ByteArrayInputStream(cursor.getBlob(0));
- cursor.close();
- return new CacheTileReader(tile, in);
- }
- }
- return null;
- }
-
- @Override
- public void setCacheSize(long l) {
-
- }
-
- class CacheTileWriter implements TileWriter {
- final ByteArrayOutputStream os;
- final Tile tile;
-
- CacheTileWriter(Tile tile, ByteArrayOutputStream os) {
- this.tile = tile;
- this.os = os;
- }
-
- public Tile getTile() {
- return tile;
- }
-
- public OutputStream getOutputStream() {
- return os;
- }
-
- public void complete(boolean success) {
- saveTile(tile, os, success);
- }
- }
-
- class CacheTileReader implements TileReader {
- final InputStream is;
- final Tile tile;
-
- public CacheTileReader(Tile tile, InputStream is) {
- this.tile = tile;
- this.is = is;
- }
-
- public Tile getTile() {
- return tile;
- }
-
- public InputStream getInputStream() {
- return is;
- }
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/data/SharedTileProvider.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/data/SharedTileProvider.java
deleted file mode 100644
index 3a322430..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/data/SharedTileProvider.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.data;
-
-import android.content.ContentProvider;
-import android.content.ContentValues;
-import android.content.Context;
-import android.database.Cursor;
-import android.database.sqlite.SQLiteDatabase;
-import android.database.sqlite.SQLiteOpenHelper;
-import android.net.Uri;
-
-/*
- * TODO: Writing to cache should be protected, tiles should be downloaded by service instead of client app.
- */
-public class SharedTileProvider extends ContentProvider {
- private static final String DB_NAME = "tilecache.db";
- public static final String PROVIDER_NAME = "org.microg.gms.maps.vtm.tile";
- public static final Uri PROVIDER_URI = Uri.parse("content://" + PROVIDER_NAME);
-
- private SQLiteHelper sqLiteHelper;
-
- public SharedTileProvider() {
- }
-
- @Override
- public int delete(Uri uri, String selection, String[] selectionArgs) {
- // Implement this to handle requests to delete one or more rows.
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
- @Override
- public String getType(Uri uri) {
- return "vnd.android.cursor.item/org.mgoogle.gms.map.tile";
- }
-
- @Override
- public Uri insert(Uri uri, ContentValues values) {
- sqLiteHelper.getWritableDatabase().insert("tiles", null, values);
- return PROVIDER_URI;
- }
-
- @Override
- public boolean onCreate() {
- sqLiteHelper = new SQLiteHelper(getContext(), DB_NAME);
- return true;
- }
-
- @Override
- public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
- return sqLiteHelper.getReadableDatabase().query("tiles", projection, selection, selectionArgs, null, null, sortOrder);
- }
-
- @Override
- public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
- return sqLiteHelper.getWritableDatabase().update("tiles", values, selection, selectionArgs);
- }
-
- class SQLiteHelper extends SQLiteOpenHelper {
- private static final int DATABASE_VERSION = 1;
- private static final String TILE_SCHEMA = "CREATE TABLE tiles(x INTEGER NOT NULL,y INTEGER NOT NULL,z INTEGER NOT NULL,time LONG NOT NULL,last_access LONG NOT NULL,data BLOB,PRIMARY KEY(x,y,z));";
-
- public SQLiteHelper(Context context, String dbName) {
- super(context, dbName, null, DATABASE_VERSION);
- }
-
- public void onCreate(SQLiteDatabase db) {
- db.execSQL(TILE_SCHEMA);
- }
-
- public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
- db.execSQL("DROP TABLE IF EXISTS tiles");
- this.onCreate(db);
- }
-
- public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
- this.onUpgrade(db, oldVersion, newVersion);
- }
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/CircleImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/CircleImpl.java
deleted file mode 100644
index 18b4a999..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/CircleImpl.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.markup;
-
-import android.os.RemoteException;
-
-import com.google.android.gms.maps.model.CircleOptions;
-import com.google.android.gms.maps.model.LatLng;
-import com.google.android.gms.maps.model.internal.ICircleDelegate;
-
-import org.microg.gms.maps.vtm.GmsMapsTypeHelper;
-import org.oscim.layers.vector.geometries.CircleDrawable;
-import org.oscim.layers.vector.geometries.Drawable;
-import org.oscim.layers.vector.geometries.Style;
-import org.oscim.map.Map;
-
-public class CircleImpl extends ICircleDelegate.Stub implements DrawableMarkup {
-
- private final String id;
- private final CircleOptions options;
- private final MarkupListener listener;
- private boolean removed = false;
-
- public CircleImpl(String id, CircleOptions options, MarkupListener listener) {
- this.id = id;
- this.listener = listener;
- this.options = options == null ? new CircleOptions() : options;
- }
-
- @Override
- public void remove() throws RemoteException {
- listener.remove(this);
- removed = true;
- }
-
- @Override
- public String getId() {
- return id;
- }
-
- @Override
- public void setCenter(LatLng center) throws RemoteException {
- options.center(center);
- listener.update(this);
- }
-
- @Override
- public LatLng getCenter() throws RemoteException {
- return options.getCenter();
- }
-
- @Override
- public void setRadius(double radius) throws RemoteException {
- options.radius(radius);
- listener.update(this);
- }
-
- @Override
- public double getRadius() throws RemoteException {
- return options.getRadius();
- }
-
- @Override
- public void setStrokeWidth(float width) throws RemoteException {
- options.strokeWidth(width);
- listener.update(this);
- }
-
- @Override
- public float getStrokeWidth() throws RemoteException {
- return options.getStrokeWidth();
- }
-
- @Override
- public void setStrokeColor(int color) throws RemoteException {
- options.strokeColor(color);
- listener.update(this);
- }
-
- @Override
- public int getStrokeColor() throws RemoteException {
- return options.getStrokeColor();
- }
-
- @Override
- public void setFillColor(int color) throws RemoteException {
- options.fillColor(color);
- listener.update(this);
- }
-
- @Override
- public int getFillColor() throws RemoteException {
- return options.getFillColor();
- }
-
- @Override
- public void setZIndex(float zIndex) throws RemoteException {
- options.zIndex(zIndex);
- listener.update(this);
- }
-
- @Override
- public float getZIndex() {
- return options.getZIndex();
- }
-
- @Override
- public void setVisible(boolean visible) throws RemoteException {
- options.visible(visible);
- listener.update(this);
- }
-
- @Override
- public boolean isVisible() {
- return options.isVisible();
- }
-
- @Override
- public boolean equalsRemote(ICircleDelegate other) throws RemoteException {
- return other != null && other.getId().equals(getId());
- }
-
- @Override
- public int hashCodeRemote() throws RemoteException {
- return id.hashCode();
- }
-
- @Override
- public boolean onClick() {
- return listener.onClick(this);
- }
-
- @Override
- public void onDragStart() {
- listener.onDragStart(this);
- }
-
- @Override
- public void onDragStop() {
- listener.onDragStop(this);
- }
-
- @Override
- public void onDragProgress() {
- listener.onDragProgress(this);
- }
-
- @Override
- public Drawable getDrawable(Map map) {
- if (!isVisible() || removed) return null;
- return new CircleDrawable(
- GmsMapsTypeHelper.fromLatLng(options.getCenter()),
- options.getRadius() / 1000.0,
- Style.builder()
- .strokeColor(options.getStrokeColor())
- .fillAlpha(1)
- .fillColor(options.getFillColor())
- .strokeWidth(options.getStrokeWidth()).build());
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/ClearableVectorLayer.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/ClearableVectorLayer.java
deleted file mode 100644
index 4dedd470..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/ClearableVectorLayer.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.markup;
-
-import org.oscim.layers.vector.VectorLayer;
-import org.oscim.map.Map;
-
-public class ClearableVectorLayer extends VectorLayer {
- public ClearableVectorLayer(Map map) {
- super(map);
- }
-
- public void clear() {
- mDrawables.clear();
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/DrawableMarkup.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/DrawableMarkup.java
deleted file mode 100644
index c91dd8d6..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/DrawableMarkup.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.markup;
-
-import org.oscim.layers.vector.geometries.Drawable;
-import org.oscim.map.Map;
-
-public interface DrawableMarkup extends Markup {
- float getZIndex();
-
- Drawable getDrawable(Map map);
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/GroundOverlayImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/GroundOverlayImpl.java
deleted file mode 100644
index a577bd2e..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/GroundOverlayImpl.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.markup;
-
-import android.os.RemoteException;
-import com.google.android.gms.dynamic.IObjectWrapper;
-import com.google.android.gms.maps.model.GroundOverlayOptions;
-import com.google.android.gms.maps.model.LatLng;
-import com.google.android.gms.maps.model.LatLngBounds;
-import com.google.android.gms.maps.model.internal.IGroundOverlayDelegate;
-
-public class GroundOverlayImpl extends IGroundOverlayDelegate.Stub {
- private LatLng position;
- private float transparency;
- private float zIndex;
- private boolean visible;
- private String id;
- private float width;
- private float height;
- private float bearing;
-
- public GroundOverlayImpl(GroundOverlayOptions options) {
-
- }
-
- @Override
- public void remove() throws RemoteException {
-
- }
-
- @Override
- public String getId() throws RemoteException {
- return id;
- }
-
- @Override
- public void setPosition(LatLng pos) throws RemoteException {
- this.position = pos;
- }
-
- @Override
- public LatLng getPosition() throws RemoteException {
- return position;
- }
-
- @Override
- public void setDimension(float dimension) throws RemoteException {
- setDimensions(dimension, dimension);
- }
-
- @Override
- public void setDimensions(float width, float height) throws RemoteException {
- this.width = width;
- this.height = height;
- }
-
- @Override
- public float getWidth() throws RemoteException {
- return width;
- }
-
- @Override
- public float getHeight() throws RemoteException {
- return height;
- }
-
- @Override
- public void setPositionFromBounds(LatLngBounds bounds) throws RemoteException {
-
- }
-
- @Override
- public LatLngBounds getBounds() throws RemoteException {
- return null;
- }
-
- @Override
- public void setBearing(float bearing) throws RemoteException {
- this.bearing = bearing;
- }
-
- @Override
- public float getBearing() throws RemoteException {
- return bearing;
- }
-
- @Override
- public void setZIndex(float zIndex) throws RemoteException {
- this.zIndex = zIndex;
- }
-
- @Override
- public float getZIndex() throws RemoteException {
- return zIndex;
- }
-
- @Override
- public void setVisible(boolean visible) throws RemoteException {
- this.visible = visible;
- }
-
- @Override
- public boolean isVisible() throws RemoteException {
- return visible;
- }
-
- @Override
- public void setTransparency(float transparency) throws RemoteException {
- this.transparency = transparency;
- }
-
- @Override
- public float getTransparency() throws RemoteException {
- return transparency;
- }
-
- @Override
- public boolean equalsRemote(IGroundOverlayDelegate other) throws RemoteException {
- return other != null && other.getId().equals(getId());
- }
-
- @Override
- public int hashCodeRemote() throws RemoteException {
- return id.hashCode();
- }
-
- @Override
- public void todo(IObjectWrapper obj) throws RemoteException {
-
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/InfoWindow.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/InfoWindow.java
deleted file mode 100644
index 95a72ae0..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/InfoWindow.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.markup;
-
-import android.content.Context;
-import android.view.View;
-import android.widget.FrameLayout;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-import com.google.android.gms.maps.model.internal.IMarkerDelegate;
-import org.microg.gms.maps.vtm.GoogleMapImpl;
-import org.microg.gms.maps.vtm.ResourcesContainer;
-import org.microg.gms.maps.vtm.R;
-
-import static android.os.Build.VERSION.SDK_INT;
-import static android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1;
-
-public class InfoWindow {
- private static final String TAG = InfoWindow.class.getName();
- private Context context;
- private View window;
- private GoogleMapImpl map;
- private MarkerImpl marker;
-
- public InfoWindow(Context context, final GoogleMapImpl map, final MarkerImpl marker) {
- super();
- this.context = context;
- this.map = map;
- this.marker = marker;
- }
-
- public void setWindow(View view) {
- window = view;
- if (window != null) {
- window.measure(0, 0);
- }
- }
-
- public boolean isComplete() {
- return window != null;
- }
-
- public void setContent(View view) {
- if (view == null)
- return;
- setWindow(new DefaultWindow(view));
- }
-
- public void buildDefault() {
- if (marker.getTitle() != null)
- setContent(new DefaultContent());
- }
-
- public void destroy() {
- if (window instanceof DefaultWindow) {
- ((DefaultWindow) window).removeAllViews();
- }
- }
-
- public IMarkerDelegate getMarker() {
- return marker;
- }
-
- /*
- @Override
- public void draw(Canvas canvas, MapView mapView, boolean shadow) {
- if (window != null && marker.getHeight() != -1 && !shadow) {
- try {
- Log.d(TAG, "draw InfoWindow");
- window.measure(0, 0);
- window.layout(0, 0, window.getMeasuredWidth(), window.getMeasuredHeight());
- //Point point = mapView.getProjection().toPixels(marker.getPosition().toGeoPoint(), null);
-
- // osmdroid 4.1 bugfix
- Point zero = mapView.getProjection().toPixels(new GeoPoint(0, 0), null);
- point.offset(-zero.x, -zero.y);
-
-
-
- point.offset(-window.getMeasuredWidth() / 2, -window.getMeasuredHeight() - marker.getHeight());
- Log.d(TAG, point.toString());
- canvas.save();
- canvas.translate(point.x, point.y);
- window.draw(canvas);
- canvas.restore();
- } catch (Exception e) {
- // This is not remote...
- }
- }
- }
-
- @Override
- public boolean onTap(GeoPoint p, MapView mapView) {
- try {
- IOnInfoWindowClickListener listener = null; //map.getInfoWindowClickListener();
- if (listener != null) {
- Point clickPoint = mapView.getProjection().toPixels(p, null);
- Point markerPoint = mapView.getProjection().toPixels(marker.getPosition().toGeoPoint(), null);
- Rect rect = new Rect(markerPoint.x - (window.getMeasuredWidth() / 2),
- markerPoint.y - marker.getHeight() - window.getMeasuredHeight(),
- markerPoint.x + (window.getMeasuredWidth() / 2),
- markerPoint.y - marker.getHeight());
- if (rect.contains(clickPoint.x, clickPoint.y)) {
- try {
- listener.onInfoWindowClick(marker);
- } catch (RemoteException e) {
- Log.w(TAG, e);
- }
- return true;
- }
-
- }
- } catch (Exception e) {
- // This is not remote...
- }
- return false;
- }
-*/
-
- private class DefaultWindow extends FrameLayout {
- @SuppressWarnings("deprecation")
- public DefaultWindow(View view) {
- super(context);
- addView(view);
- if (SDK_INT > ICE_CREAM_SANDWICH_MR1) {
- setBackground(ResourcesContainer.get().getDrawable(R.drawable.maps_default_window));
- } else {
- setBackgroundDrawable(ResourcesContainer.get().getDrawable(R.drawable.maps_default_window));
- }
- }
- }
-
- private class DefaultContent extends LinearLayout {
- public DefaultContent() {
- super(context);
- setOrientation(LinearLayout.VERTICAL);
- TextView title = new TextView(context);
- title.setTextAppearance(context,
- android.R.style.TextAppearance_DeviceDefault_Medium_Inverse);
- title.setText(marker.getTitle());
- addView(title);
- if (marker.getSnippet() != null) {
- TextView snippet = new TextView(context);
- snippet.setTextAppearance(context,
- android.R.style.TextAppearance_DeviceDefault_Inverse);
- snippet.setText(marker.getSnippet());
- addView(snippet);
- }
- }
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/MarkerImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/MarkerImpl.java
deleted file mode 100644
index 83688e2e..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/MarkerImpl.java
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.markup;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.os.RemoteException;
-import android.util.Log;
-
-import com.google.android.gms.dynamic.IObjectWrapper;
-import com.google.android.gms.dynamic.ObjectWrapper;
-import com.google.android.gms.maps.model.LatLng;
-import com.google.android.gms.maps.model.MarkerOptions;
-import com.google.android.gms.maps.model.internal.IMarkerDelegate;
-
-import org.microg.gms.maps.vtm.GmsMapsTypeHelper;
-import org.microg.gms.maps.vtm.bitmap.BitmapDescriptorImpl;
-import org.microg.gms.maps.vtm.bitmap.DefaultBitmapDescriptor;
-import org.oscim.android.canvas.AndroidBitmap;
-import org.oscim.layers.marker.MarkerItem;
-import org.oscim.layers.marker.MarkerSymbol;
-
-public class MarkerImpl extends IMarkerDelegate.Stub implements MarkerItemMarkup {
- private static final String TAG = "GmsMapMarkerImpl";
-
- private final String id;
- private final MarkerOptions options;
- private final MarkupListener listener;
- private BitmapDescriptorImpl icon;
- private AndroidBitmap oldBitmap;
- private boolean removed = false;
- private IObjectWrapper tag = null;
-
- public MarkerImpl(String id, MarkerOptions options, MarkupListener listener) {
- this.id = id;
- this.listener = listener;
- this.options = options == null ? new MarkerOptions() : options;
- if (options.getPosition() == null) {
- options.position(new LatLng(0, 0));
- }
- icon = options.getIcon() == null ? null : new BitmapDescriptorImpl(options.getIcon());
- Log.d(TAG, "New marker " + id + " with title " + options.getTitle() + " @ " +
- options.getPosition());
- }
-
- @Override
- public void remove() {
- listener.remove(this);
- removed = true;
- icon = null;
- oldBitmap = null;
- }
-
- @Override
- public String getId() {
- return id;
- }
-
- @Override
- public void setPosition(LatLng pos) {
- options.position(pos);
- listener.update(this);
- }
-
- @Override
- public LatLng getPosition() {
- return options.getPosition();
- }
-
- @Override
- public void setTitle(String title) {
- options.title(title);
- listener.update(this);
- }
-
- @Override
- public String getTitle() {
- return options.getTitle();
- }
-
- @Override
- public void setSnippet(String snippet) {
- options.snippet(snippet);
- }
-
- @Override
- public String getSnippet() {
- return options.getSnippet();
- }
-
- @Override
- public void setDraggable(boolean drag) {
- options.draggable(drag);
- }
-
- @Override
- public boolean isDraggable() {
- return options.isDraggable();
- }
-
- @Override
- public void showInfoWindow() {
-
- }
-
- @Override
- public void hideInfoWindow() {
-
- }
-
- @Override
- public boolean isInfoWindowShown() {
- return false;
- }
-
- @Override
- public void setVisible(boolean visible) {
- options.visible(visible);
- }
-
- @Override
- public boolean isVisible() {
- return options.isVisible();
- }
-
- @Override
- public boolean equalsRemote(IMarkerDelegate other) throws RemoteException {
- return other != null && other.getId().equals(getId());
- }
-
- @Override
- public int hashCodeRemote() {
- return hashCode();
- }
-
- @Override
- public int hashCode() {
- return super.hashCode();
- }
-
- @Override
- public void setIcon(IObjectWrapper obj) {
- if (obj == null) {
- icon = new BitmapDescriptorImpl();
- } else {
- icon = new BitmapDescriptorImpl(obj);
- }
- listener.update(this);
- }
-
- @Override
- public void setAnchor(float x, float y) {
- options.anchor(x, y);
- listener.update(this);
- }
-
- @Override
- public void setFlat(boolean flat) {
- options.flat(flat);
- listener.update(this);
- }
-
- @Override
- public boolean isFlat() {
- return options.isFlat();
- }
-
- @Override
- public void setRotation(float rotation) {
- options.rotation(rotation);
- listener.update(this);
- }
-
- @Override
- public float getRotation() {
- return options.getRotation();
- }
-
- @Override
- public void setInfoWindowAnchor(float x, float y) {
- options.infoWindowAnchor(x, y);
- }
-
- @Override
- public void setAlpha(float alpha) {
- options.alpha(alpha);
- listener.update(this);
- }
-
- @Override
- public float getAlpha() {
- return options.getAlpha();
- }
-
- public int getHeight() {
- Bitmap bitmap = icon.getBitmap();
- if (bitmap == null)
- return -1;
- return bitmap.getHeight();
- }
-
- @Override
- public boolean onClick() {
- return listener.onClick(this);
- }
-
- @Override
- public void onDragStart() {
- listener.onDragStart(this);
- }
-
- @Override
- public void onDragStop() {
- listener.onDragStop(this);
- }
-
- @Override
- public void onDragProgress() {
- listener.onDragProgress(this);
- }
-
- @Override
- public MarkerItem getMarkerItem(Context context) {
- if (removed) return null;
- MarkerItem item = new MarkerItem(getId(), getTitle(), getSnippet(),
- GmsMapsTypeHelper.fromLatLng(getPosition()));
- BitmapDescriptorImpl icon = this.icon;
- if (icon == null)
- icon = DefaultBitmapDescriptor.DEFAULT_DESCRIPTOR_IMPL;
- if (icon.getBitmap() != null) {
- oldBitmap = new AndroidBitmap(icon.getBitmap());
- prepareMarkerIcon(item);
- } else {
- if (!icon.loadBitmapAsync(context, new Runnable() {
- @Override
- public void run() {
- listener.update(MarkerImpl.this);
- }
- })) {
- // Was loaded since last check...
- oldBitmap = new AndroidBitmap(icon.getBitmap());
- prepareMarkerIcon(item);
- }
- // Keep old icon while loading new
- if (oldBitmap != null) {
- prepareMarkerIcon(item);
- }
- }
- return item;
- }
-
- private void prepareMarkerIcon(MarkerItem item) {
- item.setMarker(new MarkerSymbol(oldBitmap, options.getAnchorU(), options.getAnchorV(), !options.isFlat()));
- }
-
- @Override
- public void setZIndex(float zIndex) {
- options.zIndex(zIndex);
- }
-
- @Override
- public float getZIndex() {
- return options.getZIndex();
- }
-
- @Override
- public void setTag(IObjectWrapper obj) {
- this.tag = obj;
- }
-
- @Override
- public IObjectWrapper getTag() {
- return this.tag == null ? ObjectWrapper.wrap(null) : this.tag;
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/MarkerItemMarkup.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/MarkerItemMarkup.java
deleted file mode 100644
index e243d88d..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/MarkerItemMarkup.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.markup;
-
-import android.content.Context;
-
-import com.google.android.gms.maps.model.LatLng;
-
-import org.oscim.layers.marker.MarkerItem;
-
-public interface MarkerItemMarkup extends Markup {
- MarkerItem getMarkerItem(Context context);
-
- boolean isDraggable();
-
- LatLng getPosition();
-
- void setPosition(LatLng latLng);
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/Markup.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/Markup.java
deleted file mode 100644
index 583343d8..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/Markup.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.markup;
-
-public interface Markup {
- String getId();
-
- boolean onClick();
-
- void onDragStart();
- void onDragStop();
- void onDragProgress();
-
- interface MarkupListener {
- void update(Markup markup);
-
- void remove(Markup markup);
-
- boolean onClick(Markup markup);
-
- void onDragStart(Markup markup);
-
- void onDragStop(Markup markup);
-
- void onDragProgress(Markup markup);
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/PolygonImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/PolygonImpl.java
deleted file mode 100644
index d17f647b..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/PolygonImpl.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.markup;
-
-import android.os.RemoteException;
-
-import com.google.android.gms.maps.model.LatLng;
-import com.google.android.gms.maps.model.PolygonOptions;
-import com.google.android.gms.maps.model.internal.IPolygonDelegate;
-
-import org.microg.gms.maps.vtm.GmsMapsTypeHelper;
-import org.oscim.core.GeoPoint;
-import org.oscim.layers.vector.geometries.Drawable;
-import org.oscim.layers.vector.geometries.PolygonDrawable;
-import org.oscim.layers.vector.geometries.Style;
-import org.oscim.map.Map;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class PolygonImpl extends IPolygonDelegate.Stub implements DrawableMarkup {
- private static final String TAG = "GmsMapsPolygonImpl";
-
- private final String id;
- private final PolygonOptions options;
- private final MarkupListener listener;
- private boolean removed = false;
-
- public PolygonImpl(String id, PolygonOptions options, MarkupListener listener) {
- this.id = id;
- this.options = options;
- this.listener = listener;
- }
-
- @Override
- public void remove() throws RemoteException {
- listener.remove(this);
- removed = true;
- }
-
- @Override
- public String getId() {
- return id;
- }
-
- @Override
- public boolean onClick() {
- return listener.onClick(this);
- }
-
- @Override
- public void onDragStart() {
- listener.onDragStart(this);
- }
-
- @Override
- public void onDragStop() {
- listener.onDragStop(this);
- }
-
- @Override
- public void onDragProgress() {
- listener.onDragProgress(this);
- }
-
- @Override
- public void setPoints(List points) throws RemoteException {
- options.getPoints().clear();
- options.getPoints().addAll(points);
- listener.update(this);
- }
-
- @Override
- public List getPoints() throws RemoteException {
- return options.getPoints();
- }
-
- @Override
- public void setHoles(List holes) throws RemoteException {
- options.getHoles().clear();
- options.getHoles().addAll(holes);
- listener.update(this);
- }
-
- @Override
- public List getHoles() throws RemoteException {
- return options.getHoles();
- }
-
- @Override
- public void setStrokeWidth(float width) throws RemoteException {
- options.strokeWidth(width);
- listener.update(this);
- }
-
- @Override
- public float getStrokeWidth() {
- return options.getStrokeWidth();
- }
-
- @Override
- public void setStrokeColor(int color) throws RemoteException {
- options.strokeColor(color);
- listener.update(this);
- }
-
- @Override
- public int getStrokeColor() {
- return options.getStrokeColor();
- }
-
- @Override
- public void setFillColor(int color) throws RemoteException {
- options.fillColor(color);
- listener.update(this);
- }
-
- @Override
- public int getFillColor() {
- return options.getFillColor();
- }
-
- @Override
- public void setZIndex(float zIndex) throws RemoteException {
- options.zIndex(zIndex);
- listener.update(this);
- }
-
- @Override
- public float getZIndex() {
- return options.getZIndex();
- }
-
- @Override
- public Drawable getDrawable(Map map) {
- if (!isVisible() || removed) return null;
- List points = new ArrayList();
- for (LatLng point : options.getPoints()) {
- points.add(GmsMapsTypeHelper.fromLatLng(point));
- }
- if (points.size() < 3 || (points.size() == 3 && points.get(2).equals(points.get(0)))) {
- // Need at least 3 distinguished points to draw a polygon
- return null;
- }
- // TODO: holes
- return new PolygonDrawable(points, Style.builder()
- .fillAlpha(1)
- .strokeColor(getStrokeColor())
- .strokeWidth(getStrokeWidth())
- .fillColor(getFillColor())
- .build());
- }
-
- @Override
- public void setVisible(boolean visible) throws RemoteException {
- options.visible(visible);
- listener.update(this);
- }
-
- @Override
- public boolean isVisible() {
- return options.isVisible();
- }
-
- @Override
- public void setGeodesic(boolean geod) throws RemoteException {
- options.geodesic(geod);
- listener.update(this);
- }
-
- @Override
- public boolean isGeodesic() throws RemoteException {
- return options.isGeodesic();
- }
-
- @Override
- public boolean equalsRemote(IPolygonDelegate other) throws RemoteException {
- return other != null && other.getId().equals(getId());
- }
-
- @Override
- public int hashCodeRemote() throws RemoteException {
- return id.hashCode();
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/PolylineImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/PolylineImpl.java
deleted file mode 100644
index b2ff4c2f..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/PolylineImpl.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.markup;
-
-import android.os.RemoteException;
-import android.util.Log;
-
-import com.google.android.gms.maps.model.LatLng;
-import com.google.android.gms.maps.model.PolylineOptions;
-import com.google.android.gms.maps.model.internal.IPolylineDelegate;
-
-import org.microg.gms.maps.vtm.GmsMapsTypeHelper;
-import org.oscim.core.GeoPoint;
-import org.oscim.layers.vector.geometries.Drawable;
-import org.oscim.layers.vector.geometries.LineDrawable;
-import org.oscim.layers.vector.geometries.Style;
-import org.oscim.map.Map;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class PolylineImpl extends IPolylineDelegate.Stub implements DrawableMarkup {
- private static final String TAG = "GmsMapsPolylineImpl";
-
- private final String id;
- private final PolylineOptions options;
- private final MarkupListener listener;
- private boolean removed = false;
-
- public PolylineImpl(String id, PolylineOptions options, MarkupListener listener) {
- this.id = id;
- this.options = options == null ? new PolylineOptions() : options;
- this.listener = listener;
- }
-
- @Override
- public void remove() {
- listener.remove(this);
- removed = true;
- }
-
- @Override
- public String getId() {
- return id;
- }
-
- @Override
- public boolean onClick() {
- return listener.onClick(this);
- }
-
- @Override
- public void onDragStart() {
- listener.onDragStart(this);
- }
-
- @Override
- public void onDragStop() {
- listener.onDragStop(this);
- }
-
- @Override
- public void onDragProgress() {
- listener.onDragProgress(this);
- }
-
- @Override
- public void setPoints(List points) {
- options.getPoints().clear();
- options.getPoints().addAll(points);
- listener.update(this);
- }
-
- @Override
- public List getPoints() {
- return options.getPoints();
- }
-
- @Override
- public void setWidth(float width) {
- options.width(width);
- listener.update(this);
- }
-
- @Override
- public float getWidth() {
- return options.getWidth();
- }
-
- @Override
- public void setColor(int color) {
- this.options.color(color);
- listener.update(this);
- }
-
- @Override
- public int getColor() {
- return options.getColor();
- }
-
- @Override
- public void setZIndex(float zIndex) {
- options.zIndex(zIndex);
- listener.update(this);
- }
-
- @Override
- public float getZIndex() {
- return options.getZIndex();
- }
-
- @Override
- public void setVisible(boolean visible) {
- options.visible(visible);
- listener.update(this);
- }
-
- @Override
- public boolean isVisible() {
- return options.isVisible();
- }
-
- @Override
- public void setGeodesic(boolean geod) {
- options.geodesic(geod);
- listener.update(this);
- }
-
- @Override
- public boolean isGeodesic() {
- return options.isGeodesic();
- }
-
- @Override
- public boolean equalsRemote(IPolylineDelegate other) throws RemoteException {
- Log.d(TAG, "equalsRemote");
- return other != null && other.getId().equals(getId());
- }
-
- @Override
- public int hashCodeRemote() {
- Log.d(TAG, "hashcodeRemote");
- return id.hashCode();
- }
-
- @Override
- public Drawable getDrawable(Map map) {
- if (!isVisible() || removed) return null;
- if (options.getPoints().size() < 2) {
- // You hardly draw a line with less than two points
- return null;
- }
- List points = new ArrayList();
- for (LatLng point : options.getPoints()) {
- points.add(GmsMapsTypeHelper.fromLatLng(point));
- }
- return new LineDrawable(points, Style.builder().strokeColor(getColor()).strokeWidth(getWidth()).build());
- }
-}
diff --git a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/TileOverlayImpl.java b/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/TileOverlayImpl.java
deleted file mode 100644
index c13c0f6d..00000000
--- a/play-services-maps-core-vtm/src/main/java/org/microg/gms/maps/vtm/markup/TileOverlayImpl.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (C) 2013-2017 microG Project Team
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.microg.gms.maps.vtm.markup;
-
-import com.google.android.gms.maps.model.internal.ITileOverlayDelegate;
-
-public class TileOverlayImpl extends ITileOverlayDelegate.Stub {
-}
diff --git a/play-services-maps-core-vtm/src/main/res/drawable/maps_default_marker.png b/play-services-maps-core-vtm/src/main/res/drawable/maps_default_marker.png
deleted file mode 100644
index a963793a..00000000
Binary files a/play-services-maps-core-vtm/src/main/res/drawable/maps_default_marker.png and /dev/null differ
diff --git a/play-services-maps-core-vtm/src/main/res/drawable/maps_default_window.9.png b/play-services-maps-core-vtm/src/main/res/drawable/maps_default_window.9.png
deleted file mode 100644
index 57724d79..00000000
Binary files a/play-services-maps-core-vtm/src/main/res/drawable/maps_default_window.9.png and /dev/null differ
diff --git a/play-services-maps-core-vtm/src/main/res/drawable/nop.png b/play-services-maps-core-vtm/src/main/res/drawable/nop.png
deleted file mode 100644
index 0e676831..00000000
Binary files a/play-services-maps-core-vtm/src/main/res/drawable/nop.png and /dev/null differ
diff --git a/play-services-maps-core-vtm/vtm-microg-theme/build.gradle b/play-services-maps-core-vtm/vtm-microg-theme/build.gradle
deleted file mode 100644
index 3304c9a0..00000000
--- a/play-services-maps-core-vtm/vtm-microg-theme/build.gradle
+++ /dev/null
@@ -1,11 +0,0 @@
-apply plugin: 'java'
-apply plugin: 'maven'
-
-dependencies {
- compile "org.microg:vtm:0.9.1-mod"
-}
-
-sourceSets {
- main.java.srcDirs = ['src']
- main.resources.srcDirs = ['resources']
-}
diff --git a/play-services-maps-core-vtm/vtm-microg-theme/resources/assets/styles/microg.xml b/play-services-maps-core-vtm/vtm-microg-theme/resources/assets/styles/microg.xml
deleted file mode 100644
index 4fd884f6..00000000
--- a/play-services-maps-core-vtm/vtm-microg-theme/resources/assets/styles/microg.xml
+++ /dev/null
@@ -1,546 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-