Enhance Location API

This commit is contained in:
mar-v-in 2015-10-04 04:40:58 +02:00
parent cb0458f17e
commit 6f5bf23351
7 changed files with 183 additions and 7 deletions

View File

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

View File

@ -7,7 +7,7 @@ import android.os.Bundle;
import com.google.android.gms.common.api.Status; import com.google.android.gms.common.api.Status;
import com.google.android.gms.location.places.AutocompleteFilter; import com.google.android.gms.location.places.AutocompleteFilter;
import com.google.android.gms.location.places.internal.IPlacesCallbacks; import com.google.android.gms.location.places.internal.IPlacesCallbacks;
import com.google.android.gms.location.internal.ISettingsCallback; import com.google.android.gms.location.internal.ISettingsCallbacks;
import com.google.android.gms.location.internal.LocationRequestInternal; import com.google.android.gms.location.internal.LocationRequestInternal;
import com.google.android.gms.location.internal.LocationRequestUpdateData; import com.google.android.gms.location.internal.LocationRequestUpdateData;
import com.google.android.gms.location.places.NearbyAlertRequest; import com.google.android.gms.location.places.NearbyAlertRequest;
@ -64,7 +64,7 @@ interface IGoogleLocationManagerService {
LocationAvailability iglms34(String var1) = 33; LocationAvailability iglms34(String var1) = 33;
IBinder iglms51() = 50; IBinder iglms51() = 50;
void iglms63(in LocationSettingsRequest settingsRequest, ISettingsCallback callback, String packageName) = 62; 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 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 iglms15(String var1, in PlacesParams var2, IPlacesCallbacks var3) = 14;

View File

@ -1,5 +0,0 @@
package com.google.android.gms.location.internal;
interface ISettingsCallback {
// TODO
}

View File

@ -0,0 +1,7 @@
package com.google.android.gms.location.internal;
import com.google.android.gms.location.LocationSettingsResult;
interface ISettingsCallbacks {
void onLocationSettingsResult(in LocationSettingsResult result);
}

View File

@ -16,8 +16,27 @@
package com.google.android.gms.location; package com.google.android.gms.location;
import org.microg.gms.common.PublicApi;
import org.microg.safeparcel.AutoSafeParcelable; import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
import java.util.List;
@PublicApi
public class LocationSettingsRequest extends AutoSafeParcelable { 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;
public static final Creator<LocationSettingsRequest> CREATOR = new AutoCreator<LocationSettingsRequest>(LocationSettingsRequest.class); public static final Creator<LocationSettingsRequest> CREATOR = new AutoCreator<LocationSettingsRequest>(LocationSettingsRequest.class);
} }

View File

@ -0,0 +1,60 @@
/*
* Copyright 2013-2015 microG Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package 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;
@PublicApi
public class LocationSettingsResult extends AutoSafeParcelable implements Result {
@SafeParceled(1000)
private int versionCode = 1;
@SafeParceled(1)
private Status status;
@SafeParceled(2)
private LocationSettingsStates settings;
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

@ -0,0 +1,92 @@
/*
* Copyright 2013-2015 microG Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.gms.location;
import org.microg.gms.common.PublicApi;
import org.microg.safeparcel.AutoSafeParcelable;
import org.microg.safeparcel.SafeParceled;
@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;
}
@PublicApi(exclude = true)
public static final Creator<LocationSettingsStates> CREATOR = new AutoCreator<LocationSettingsStates>(LocationSettingsStates.class);
}