0
0
Fork 0
mirror of https://github.com/YTVanced/VancedMicroG synced 2024-11-30 15:13:02 +00:00

Delete unnecessary folders

This commit is contained in:
Venny 2020-07-16 22:31:55 +02:00
parent 832a98d01a
commit a0e5b8291f
300 changed files with 0 additions and 20609 deletions

View file

@ -1,37 +0,0 @@
/*
* Copyright 2013-2015 microG Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply plugin: 'com.android.library'
android {
compileSdkVersion androidCompileSdk
buildToolsVersion "$androidBuildVersionTools"
defaultConfig {
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
dependencies {
api project(':play-services-basement')
}

View file

@ -1,34 +0,0 @@
#
# Copyright 2013-2016 microG Project Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
POM_NAME=Play Services Internal Location API
POM_DESCRIPTION=Interfaces and objects for IPC between Play Services Library and Play Services Core
POM_PACKAGING=aar
POM_URL=https://github.com/microg/android_external_GmsApi
POM_SCM_URL=https://github.com/microg/android_external_GmsApi
POM_SCM_CONNECTION=scm:git@github.com:microg/android_external_GmsApi.git
POM_SCM_DEV_CONNECTION=scm:git@github.com:microg/android_external_GmsApi.git
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=mar-v-in
POM_DEVELOPER_NAME=Marvin W

View file

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2013-2017 microG Project Team
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<manifest package="org.microg.gms.location.api"/>

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location;
parcelable ActivityRecognitionResult;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location;
parcelable GeofencingRequest;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location;
parcelable GestureRequest;

View file

@ -1,11 +0,0 @@
package com.google.android.gms.location;
import android.location.Location;
import com.google.android.gms.location.LocationAvailability;
import com.google.android.gms.location.LocationResult;
interface ILocationCallback {
void onLocationResult(in LocationResult result) = 0;
void onLocationAvailability(in LocationAvailability availability) = 1;
}

View file

@ -1,7 +0,0 @@
package com.google.android.gms.location;
import android.location.Location;
interface ILocationListener {
void onLocationChanged(in Location location);
}

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location;
parcelable LocationAvailability;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location;
parcelable LocationRequest;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location;
parcelable LocationResult;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location;
parcelable LocationSettingsRequest;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location;
parcelable LocationSettingsResult;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location;
parcelable LocationStatus;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location.internal;
parcelable FusedLocationProviderResult;

View file

@ -1,7 +0,0 @@
package com.google.android.gms.location.internal;
import com.google.android.gms.location.internal.FusedLocationProviderResult;
interface IFusedLocationProviderCallback {
void onFusedLocationProviderResult(in FusedLocationProviderResult result) = 0;
}

View file

@ -1,9 +0,0 @@
package com.google.android.gms.location.internal;
import android.app.PendingIntent;
interface IGeofencerCallbacks {
void onAddGeofenceResult(int statusCode, in String[] requestIds) = 0;
void onRemoveGeofencesByRequestIdsResult(int statusCode, in String[] requestIds) = 1;
void onRemoveGeofencesByPendingIntentResult(int statusCode, in PendingIntent pendingIntent) = 2;
}

View file

@ -1,88 +0,0 @@
package com.google.android.gms.location.internal;
import android.app.PendingIntent;
import android.location.Location;
import android.os.Bundle;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.location.places.AutocompleteFilter;
import com.google.android.gms.location.places.internal.IPlacesCallbacks;
import com.google.android.gms.location.internal.ISettingsCallbacks;
import com.google.android.gms.location.internal.LocationRequestInternal;
import com.google.android.gms.location.internal.LocationRequestUpdateData;
import com.google.android.gms.location.internal.ParcelableGeofence;
import com.google.android.gms.location.places.NearbyAlertRequest;
import com.google.android.gms.location.places.PlaceFilter;
import com.google.android.gms.location.places.PlaceRequest;
import com.google.android.gms.location.places.PlaceReport;
import com.google.android.gms.location.places.internal.PlacesParams;
import com.google.android.gms.location.places.UserAddedPlace;
import com.google.android.gms.location.places.UserDataType;
import com.google.android.gms.location.ActivityRecognitionResult;
import com.google.android.gms.location.GeofencingRequest;
import com.google.android.gms.location.GestureRequest;
import com.google.android.gms.location.LocationAvailability;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationSettingsRequest;
import com.google.android.gms.location.LocationStatus;
import com.google.android.gms.location.internal.IGeofencerCallbacks;
import com.google.android.gms.location.ILocationListener;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
interface IGoogleLocationManagerService {
void addGeofencesList(in List<ParcelableGeofence> 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;
}

View file

@ -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);
}

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location.internal;
parcelable LocationRequestInternal;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location.internal;
parcelable LocationRequestUpdateData;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location.internal;
parcelable ParcelableGeofence;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location.places;
parcelable AutocompleteFilter;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location.places;
parcelable NearbyAlertRequest;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location.places;
parcelable PlaceFilter;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location.places;
parcelable PlaceReport;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location.places;
parcelable PlaceRequest;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location.places;
parcelable UserAddedPlace;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location.places;
parcelable UserDataType;

View file

@ -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);
}

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location.places.internal;
parcelable PlacesParams;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location.reporting;
parcelable ReportingState;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location.reporting;
parcelable UploadRequest;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.location.reporting;
parcelable UploadRequestResult;

View file

@ -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;
}

View file

@ -1,3 +0,0 @@
package com.google.android.gms.maps.model;
parcelable LatLng;

View file

@ -1,3 +0,0 @@
package com.google.android.gms.maps.model;
parcelable LatLngBounds;

View file

@ -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.
* <p>
* 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.
* <p>
* {@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<DetectedActivity> 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<DetectedActivity> 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<DetectedActivity> 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.
* <p>
* 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<ActivityRecognitionResult> 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.
* <p>
* 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<DetectedActivity> 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.
* <p>
* 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<ActivityRecognitionResult> 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<ActivityRecognitionResult> CREATOR = new AutoCreator<ActivityRecognitionResult>(ActivityRecognitionResult.class);
}

View file

@ -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.
* <p>
* The larger the value, the more consistent the data used to perform the classification is
* with the detected activity.
* <p>
* 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.
* <p>
* 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<DetectedActivity> CREATOR = new AutoCreator<DetectedActivity>(DetectedActivity.class);
}

View file

@ -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;
}
}
}

View file

@ -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);
}
}
}

View file

@ -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
* <p>
* 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<Geofence> 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<byte[]> parceledGeofences = (ArrayList<byte[]>) intent.getSerializableExtra(EXTRA_GEOFENCE_LIST);
if (parceledGeofences != null) {
event.triggeringGeofences = new ArrayList<Geofence>();
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<Geofence> 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;
}
}

View file

@ -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<GeofencingRequest> CREATOR = new AutoCreator<GeofencingRequest>(GeofencingRequest.class);
}

View file

@ -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<GestureRequest> CREATOR = new AutoCreator<GestureRequest>(GestureRequest.class);
}

View file

@ -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.
* <p/>
* 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.
* <p/>
* 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}.
* <p/>
* 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<LocationAvailability> CREATOR = new AutoCreator<LocationAvailability>(LocationAvailability.class);
}

View file

@ -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.
* <p/>
* LocationRequest objects are used to request a quality of service for location updates from the
* FusedLocationProviderApi.
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* 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
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* The location client will automatically stop updates after the request expires.
* <p/>
* 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.
* <p/>
* This expiration time uses the same time base as {@link SystemClock#elapsedRealtime()}.
* <p/>
* The location client will automatically stop updates after the request expires.
* <p/>
* 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.
* <p/>
* 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).
* <p/>
* This allows your application to passively acquire locations at a rate faster than it
* actively acquires locations, saving power.
* <p/>
* Unlike {@link #setInterval(long)}, this parameter is exact. Your application will never
* receive updates faster than this value.
* <p/>
* 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)}).
* <p/>
* An interval of 0 is allowed, but not recommended, since location updates may be extremely
* fast on future implementations.
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* Applications with only the coarse location permission may have their interval silently
* throttled.
* <p/>
* An interval of 0 is allowed, but not recommended, since location updates may be extremely
* fast on future implementations.
* <p/>
* {@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.
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* Use with a priority constant such as {@link #PRIORITY_HIGH_ACCURACY}. No other values are
* accepted.
* <p/>
* 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.
* <p/>
* {@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
* <p/>
* 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<LocationRequest> CREATOR = new AutoCreator<LocationRequest>(LocationRequest.class);
}

View file

@ -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<Location> locations;
private LocationResult(List<Location> locations) {
this.locations = locations;
}
public static LocationResult create(List<Location> locations) {
return new LocationResult(locations);
}
public static final Creator<LocationResult> CREATOR = new AutoCreator<LocationResult>(LocationResult.class);
}

View file

@ -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<LocationRequest> requests;
@SafeParceled(2)
@PublicApi(exclude = true)
public boolean alwaysShow;
@PublicApi(exclude = true)
public boolean needBle;
private LocationSettingsRequest() {
}
private LocationSettingsRequest(List<LocationRequest> 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<LocationRequest> requests = new ArrayList<LocationRequest>();
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<LocationRequest> 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<LocationSettingsRequest> CREATOR = new AutoCreator<LocationSettingsRequest>(LocationSettingsRequest.class);
}

View file

@ -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<LocationSettingsResult> CREATOR = new AutoCreator<LocationSettingsResult>(LocationSettingsResult.class);
}

View file

@ -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<LocationSettingsStates> CREATOR = new AutoCreator<LocationSettingsStates>(LocationSettingsStates.class);
}

View file

@ -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;
}

View file

@ -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<LocationStatus> CREATOR = new AutoCreator<LocationStatus>(LocationStatus.class);
}

View file

@ -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<ClientIdentity> CREATOR = new AutoCreator<ClientIdentity>(ClientIdentity.class);
}

View file

@ -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<FusedLocationProviderResult> CREATOR = new AutoCreator<FusedLocationProviderResult>(FusedLocationProviderResult.class);
}

View file

@ -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<ClientIdentity> 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<LocationRequestInternal> CREATOR = new AutoCreator<LocationRequestInternal>(LocationRequestInternal.class);
}

View file

@ -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<LocationRequestUpdateData> CREATOR = new AutoCreator<LocationRequestUpdateData>(LocationRequestUpdateData.class);
}

View file

@ -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<ParcelableGeofence> CREATOR = new AutoCreator<ParcelableGeofence>(ParcelableGeofence.class);
}

View file

@ -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<AutocompleteFilter> CREATOR = new AutoCreator<AutocompleteFilter>(AutocompleteFilter.class);
}

View file

@ -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<NearbyAlertRequest> CREATOR = new AutoCreator<NearbyAlertRequest>(NearbyAlertRequest.class);
}

View file

@ -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<Place> {
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.
* <p/>
* 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.
* <p/>
* We recommend placing this information below any place information. See
* <a href="https://developers.google.com/places/android/attributions#third-party">Displaying Attributions</a> 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.
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* The elements of this list are drawn from <code>Place.TYPE_*</code> constants, though one should
* expect there could be new place types returned that were introduced after an app was
* published.
*/
List<Integer> getPlaceTypes();
/**
* Returns the price level for this place on a scale from 0 (cheapest) to 4.
* <p/>
* If no price level is known, a negative value is returned.
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* 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.
* <p/>
* 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();
}

View file

@ -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<PlaceFilter> CREATOR = new AutoCreator<PlaceFilter>(PlaceFilter.class);
}

View file

@ -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<PlaceReport> CREATOR = new AutoCreator<PlaceReport>(PlaceReport.class);
}

View file

@ -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<PlaceRequest> CREATOR = new AutoCreator<PlaceRequest>(PlaceRequest.class);
}

View file

@ -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<UserAddedPlace> CREATOR = new AutoCreator<UserAddedPlace>(UserAddedPlace.class);
}

View file

@ -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<UserDataType> CREATOR = new AutoCreator<UserDataType>(UserDataType.class);
}

View file

@ -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<Integer> typesDeprecated = new ArrayList<Integer>();
@SafeParceled(14)
public String address;
@SafeParceled(15)
public String phoneNumber;
@SafeParceled(16)
public String regularOpenHours;
@SafeParceled(value = 17, subClass = String.class)
public List<String> attributions = new ArrayList<String>();
@SafeParceled(19)
public String name;
@SafeParceled(value = 20, subClass = Integer.class)
public List<Integer> placeTypes = new ArrayList<Integer>();
@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<Integer> 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<PlaceImpl> CREATOR = new AutoSafeParcelable.AutoCreator<PlaceImpl>(PlaceImpl.class);
}

View file

@ -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<PlacesParams> CREATOR = new AutoCreator<PlacesParams>(PlacesParams.class);
}

View file

@ -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<ReportingState> CREATOR = new AutoCreator<ReportingState>(ReportingState.class);
}

View file

@ -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<UploadRequest> CREATOR = new AutoCreator<UploadRequest>(UploadRequest.class);
}

View file

@ -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<UploadRequestResult> CREATOR = new AutoCreator<UploadRequestResult>(UploadRequestResult.class);
}

View file

@ -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.
* <p/>
* 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<LatLng> CREATOR = new AutoCreator<LatLng>(LatLng.class);
}

View file

@ -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.
* <p/>
* The bounds conceptually includes all points where:
* <ul>
* <li>the latitude is in the range [northeast.latitude, southwest.latitude];</li>
* <li>the longitude is in the range [southwest.longtitude, northeast.longitude]
* if southwest.longtitude northeast.longitude; and</li>
* <li>the longitude is in the range [southwest.longitude, 180) [-180, northeast.longitude]
* if southwest.longtitude > northeast.longitude.</li>
* </ul>
*
* @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.
* <p/>
* 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<LatLngBounds> CREATOR = new AutoCreator<LatLngBounds>(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.
* <p/>
* 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;
}
}
}

View file

@ -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";
}

View file

@ -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
}
}

View file

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ SPDX-FileCopyrightText: 2020, microG Project Team
~ SPDX-License-Identifier: Apache-2.0
-->
<manifest package="org.microg.gms.location.core" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application>
<service android:name="org.microg.gms.location.GoogleLocationManagerService">
<intent-filter>
<action android:name="com.google.android.location.internal.GoogleLocationManagerService.START"/>
</intent-filter>
</service>
<service android:name="org.microg.gms.location.ReportingAndroidService">
<intent-filter>
<action android:name="com.google.android.location.reporting.service.START"/>
<action android:name="com.google.android.gms.location.reporting.service.START"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</service>
</application>
</manifest>

View file

@ -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<LocationRequestHelper> currentRequests = new ArrayList<LocationRequestHelper>();
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--;
}
}
}
}

View file

@ -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);
}
}

View file

@ -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<ParcelableGeofence> 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;
}
}

View file

@ -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();
}

View file

@ -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;
}
}

View file

@ -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();
}
}

View file

@ -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<LocationRequestHelper> requests = new ArrayList<LocationRequestHelper>();
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;
}
}
}

View file

@ -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);
}
}

View file

@ -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;
}
}

View file

@ -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<LocationRequestHelper> = 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()
}
}

View file

@ -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')
}

View file

@ -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

View file

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2013-2017 microG Project Team
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<manifest package="org.microg.gms.location"
xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<receiver android:name="org.microg.gms.location.NativeLocationClientImpl$NativePendingIntentForwarder"/>
</application>
</manifest>

View file

@ -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.ApiOptions.NoOptions> API = new Api<Api.ApiOptions.NoOptions>(new ActivityRecognitionApiBuilder());
/**
* Entry point to the activity recognition APIs.
*/
public static final ActivityRecognitionApi ActivityRecognitionApi = new ActivityRecognitionApiImpl();
}

View file

@ -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.
* <p>
* The methods must be used in conjunction with a GoogleApiClient. E.g.
* <pre>
* new GoogleApiClient.Builder(context)
* .addApi(ActivityRecognition.API)
* .addConnectionCallbacks(this)
* .addOnConnectionFailedListener(this)
* .build()
* </pre>
*/
public interface ActivityRecognitionApi {
/**
* Removes all activity updates for the specified PendingIntent.
* <p>
* 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<Status> removeActivityUpdates(GoogleApiClient client, PendingIntent callbackIntent);
/**
* Register for activity recognition updates.
* <p>
* 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.
* <p>
* 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.
* <p>
* 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.
* <p>
* Activities may arrive several seconds after the requested detectionIntervalMillis if the
* activity detection service requires more samples to make a more accurate prediction.
* <p>
* 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.
* <p>
* 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.
* <p>
* 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.
* <p>
* 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.
* <p>
* 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<Status> requestActivityUpdates(GoogleApiClient client, long detectionIntervalMillis, PendingIntent callbackIntent);
}

View file

@ -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<Status> requestLocationUpdates(GoogleApiClient client, LocationRequest request,
LocationListener listener);
PendingResult<Status> requestLocationUpdates(GoogleApiClient client, LocationRequest request,
LocationListener listener, Looper looper);
PendingResult<Status> requestLocationUpdates(GoogleApiClient client, LocationRequest request,
PendingIntent callbackIntent);
PendingResult<Status> removeLocationUpdates(GoogleApiClient client, LocationListener listener);
PendingResult<Status> removeLocationUpdates(GoogleApiClient client,
PendingIntent callbackIntent);
PendingResult<Status> setMockMode(GoogleApiClient client, boolean isMockMode);
PendingResult<Status> setMockLocation(GoogleApiClient client, Location mockLocation);
}

View file

@ -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.
* <p>
* The methods must be used in conjunction with a GoogleApiClient. E.g.
* <pre>
* new GoogleApiClient.Builder(context)
* .addApi(LocationServices.API)
* .addConnectionCallbacks(this)
* .addOnConnectionFailedListener(this)
* .build()
* </pre>
*/
public interface GeofencingApi {
PendingResult<Status> addGeofences(GoogleApiClient client, GeofencingRequest geofencingRequest, PendingIntent pendingIntent);
@Deprecated
PendingResult<Status> addGeofences(GoogleApiClient client, List<Geofence> geofences, PendingIntent pendingIntent);
PendingResult<Status> removeGeofences(GoogleApiClient client, List<String> geofenceRequestIds);
PendingResult<Status> removeGeofences(GoogleApiClient client, PendingIntent pendingIntent);
}

View file

@ -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();
}
}

View file

@ -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);
}

View file

@ -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.ApiOptions.NoOptions> API = new Api<Api.ApiOptions.NoOptions>(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();
}

View file

@ -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;
}

View file

@ -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.
* <p>
* 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<LocationSettingsResult> checkLocationSettings(GoogleApiClient client, LocationSettingsRequest locationSettingsRequest);
}

View file

@ -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<Api.ApiOptions.NoOptions> {
@Override
public ApiConnection build(Context context, Looper looper, Api.ApiOptions.NoOptions options, AccountInfo accountInfo, GoogleApiClient.ConnectionCallbacks callbacks, GoogleApiClient.OnConnectionFailedListener connectionFailedListener) {
return new ActivityRecognitionClientImpl(context, callbacks, connectionFailedListener);
}
}

View file

@ -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<Status> 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<Status> 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<Status> callVoid(GoogleApiClient client, final Runnable runnable) {
return GmsConnector.call(client, ActivityRecognition.API, new GmsConnector.Callback<ActivityRecognitionClientImpl, Status>() {
@Override
public void onClientAvailable(ActivityRecognitionClientImpl client, ResultProvider<Status> resultProvider) throws RemoteException {
runnable.run(client);
resultProvider.onResultAvailable(Status.SUCCESS);
}
});
}
private interface Runnable {
void run(ActivityRecognitionClientImpl client) throws RemoteException;
}
}

View file

@ -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);
}
}

Some files were not shown because too many files have changed in this diff Show more