diff options
Diffstat (limited to 'location')
-rw-r--r-- | location/java/android/location/GeoFenceParams.aidl | 23 | ||||
-rw-r--r-- | location/java/android/location/GeoFenceParams.java | 132 | ||||
-rw-r--r-- | location/java/android/location/IGeoFenceListener.aidl | 30 | ||||
-rw-r--r-- | location/java/android/location/IGeoFencer.aidl | 33 | ||||
-rw-r--r-- | location/java/android/location/LocationManager.java | 22 |
5 files changed, 240 insertions, 0 deletions
diff --git a/location/java/android/location/GeoFenceParams.aidl b/location/java/android/location/GeoFenceParams.aidl new file mode 100644 index 0000000..3e9be4c --- /dev/null +++ b/location/java/android/location/GeoFenceParams.aidl @@ -0,0 +1,23 @@ +/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. + * + * Not a Contribution, Apache license notifications and license are retained + * for attribution purposes only. + * + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.location; + +parcelable GeoFenceParams; diff --git a/location/java/android/location/GeoFenceParams.java b/location/java/android/location/GeoFenceParams.java new file mode 100644 index 0000000..aa6e245 --- /dev/null +++ b/location/java/android/location/GeoFenceParams.java @@ -0,0 +1,132 @@ +/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. + * + * Not a Contribution, Apache license notifications and license are retained + * for attribution purposes only. + * + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.location; + +import android.app.PendingIntent; +import android.os.Binder; +import android.os.Parcel; +import android.os.Parcelable; +import java.io.PrintWriter; + +/** + * GeoFenceParams for internal use + * {@hide} + */ +public class GeoFenceParams implements Parcelable { + public static final int ENTERING = 1; + public static final int LEAVING = 2; + public final int mUid; + public final double mLatitude; + public final double mLongitude; + public final float mRadius; + public final long mExpiration; + public final PendingIntent mIntent; + public final String mPackageName; + + public static final Parcelable.Creator<GeoFenceParams> CREATOR = new Parcelable.Creator<GeoFenceParams>() { + public GeoFenceParams createFromParcel(Parcel in) { + return new GeoFenceParams(in); + } + + @Override + public GeoFenceParams[] newArray(int size) { + return new GeoFenceParams[size]; + } + }; + + public GeoFenceParams(double lat, double lon, float r, + long expire, PendingIntent intent, String packageName) { + this(Binder.getCallingUid(), lat, lon, r, expire, intent, packageName); + } + + public GeoFenceParams(int uid, double lat, double lon, float r, + long expire, PendingIntent intent, String packageName) { + mUid = uid; + mLatitude = lat; + mLongitude = lon; + mRadius = r; + mExpiration = expire; + mIntent = intent; + mPackageName = packageName; + } + + private GeoFenceParams(Parcel in) { + mUid = in.readInt(); + mLatitude = in.readDouble(); + mLongitude = in.readDouble(); + mRadius = in.readFloat(); + mExpiration = in.readLong(); + mIntent = in.readParcelable(null); + mPackageName = in.readString(); + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeInt(mUid); + dest.writeDouble(mLatitude); + dest.writeDouble(mLongitude); + dest.writeFloat(mRadius); + dest.writeLong(mExpiration); + dest.writeParcelable(mIntent, 0); + dest.writeString(mPackageName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("GeoFenceParams:\n\tmUid - "); + sb.append(mUid); + sb.append("\n\tmLatitide - "); + sb.append(mLatitude); + sb.append("\n\tmLongitude - "); + sb.append(mLongitude); + sb.append("\n\tmRadius - "); + sb.append(mRadius); + sb.append("\n\tmExpiration - "); + sb.append(mExpiration); + sb.append("\n\tmIntent - "); + sb.append(mIntent); + return sb.toString(); + } + + public long getExpiration() { + return mExpiration; + } + + public PendingIntent getIntent() { + return mIntent; + } + + public int getCallerUid() { + return mUid; + } + + public void dump(PrintWriter pw, String prefix) { + pw.println(prefix + this); + pw.println(prefix + "mLatitude=" + mLatitude + " mLongitude=" + mLongitude); + pw.println(prefix + "mRadius=" + mRadius + " mExpiration=" + mExpiration); + } +} diff --git a/location/java/android/location/IGeoFenceListener.aidl b/location/java/android/location/IGeoFenceListener.aidl new file mode 100644 index 0000000..ccec143 --- /dev/null +++ b/location/java/android/location/IGeoFenceListener.aidl @@ -0,0 +1,30 @@ +/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. + * + * Not a Contribution, Apache license notifications and license are retained + * for attribution purposes only. + * + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.location; + +import android.app.PendingIntent; + +/** + * {@hide} + */ +oneway interface IGeoFenceListener { + void geoFenceExpired(in PendingIntent intent); +} diff --git a/location/java/android/location/IGeoFencer.aidl b/location/java/android/location/IGeoFencer.aidl new file mode 100644 index 0000000..d576c6e --- /dev/null +++ b/location/java/android/location/IGeoFencer.aidl @@ -0,0 +1,33 @@ +/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. + * + * Not a Contribution, Apache license notifications and license are retained + * for attribution purposes only. + * + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.location; + +import android.location.GeoFenceParams; +import android.app.PendingIntent; + +/** + * {@hide} + */ +interface IGeoFencer { + boolean setGeoFence(in IBinder who, in GeoFenceParams params); + void clearGeoFence(in IBinder who, in PendingIntent fence); + void clearGeoFenceUser(int uid); +} diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java index 2c19324..fd7e85c 100644 --- a/location/java/android/location/LocationManager.java +++ b/location/java/android/location/LocationManager.java @@ -348,6 +348,7 @@ public class LocationManager { * @return list of Strings containing names of the providers */ public List<String> getProviders(boolean enabledOnly) { + android.util.SeempLog.record(62); try { return mService.getProviders(null, enabledOnly); } catch (RemoteException e) { @@ -368,6 +369,7 @@ public class LocationManager { * given provider. */ public LocationProvider getProvider(String name) { + android.util.SeempLog.record(61); checkProvider(name); try { ProviderProperties properties = mService.getProviderProperties(name); @@ -392,6 +394,7 @@ public class LocationManager { * @return list of Strings containing names of the providers */ public List<String> getProviders(Criteria criteria, boolean enabledOnly) { + android.util.SeempLog.record(62); checkCriteria(criteria); try { return mService.getProviders(criteria, enabledOnly); @@ -424,6 +427,7 @@ public class LocationManager { * @return name of the provider that best matches the requirements */ public String getBestProvider(Criteria criteria, boolean enabledOnly) { + android.util.SeempLog.record(59); checkCriteria(criteria); try { return mService.getBestProvider(criteria, enabledOnly); @@ -456,6 +460,7 @@ public class LocationManager { @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION}) public void requestLocationUpdates(String provider, long minTime, float minDistance, LocationListener listener) { + android.util.SeempLog.record(64); checkProvider(provider); checkListener(listener); @@ -488,6 +493,7 @@ public class LocationManager { @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION}) public void requestLocationUpdates(String provider, long minTime, float minDistance, LocationListener listener, Looper looper) { + android.util.SeempLog.record(64); checkProvider(provider); checkListener(listener); @@ -521,6 +527,7 @@ public class LocationManager { @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION}) public void requestLocationUpdates(long minTime, float minDistance, Criteria criteria, LocationListener listener, Looper looper) { + android.util.SeempLog.record(64); checkCriteria(criteria); checkListener(listener); @@ -549,6 +556,7 @@ public class LocationManager { @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION}) public void requestLocationUpdates(String provider, long minTime, float minDistance, PendingIntent intent) { + android.util.SeempLog.record(64); checkProvider(provider); checkPendingIntent(intent); @@ -651,6 +659,7 @@ public class LocationManager { @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION}) public void requestLocationUpdates(long minTime, float minDistance, Criteria criteria, PendingIntent intent) { + android.util.SeempLog.record(64); checkCriteria(criteria); checkPendingIntent(intent); @@ -680,6 +689,7 @@ public class LocationManager { */ @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION}) public void requestSingleUpdate(String provider, LocationListener listener, Looper looper) { + android.util.SeempLog.record(64); checkProvider(provider); checkListener(listener); @@ -710,6 +720,7 @@ public class LocationManager { */ @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION}) public void requestSingleUpdate(Criteria criteria, LocationListener listener, Looper looper) { + android.util.SeempLog.record(64); checkCriteria(criteria); checkListener(listener); @@ -733,6 +744,7 @@ public class LocationManager { */ @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION}) public void requestSingleUpdate(String provider, PendingIntent intent) { + android.util.SeempLog.record(64); checkProvider(provider); checkPendingIntent(intent); @@ -757,6 +769,7 @@ public class LocationManager { */ @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION}) public void requestSingleUpdate(Criteria criteria, PendingIntent intent) { + android.util.SeempLog.record(64); checkCriteria(criteria); checkPendingIntent(intent); @@ -825,6 +838,7 @@ public class LocationManager { @SystemApi public void requestLocationUpdates(LocationRequest request, LocationListener listener, Looper looper) { + android.util.SeempLog.record(64); checkListener(listener); requestLocationUpdates(request, listener, looper, null); } @@ -852,6 +866,7 @@ public class LocationManager { */ @SystemApi public void requestLocationUpdates(LocationRequest request, PendingIntent intent) { + android.util.SeempLog.record(64); checkPendingIntent(intent); requestLocationUpdates(request, null, null, intent); } @@ -870,6 +885,7 @@ public class LocationManager { private void requestLocationUpdates(LocationRequest request, LocationListener listener, Looper looper, PendingIntent intent) { + android.util.SeempLog.record(64); String packageName = mContext.getPackageName(); @@ -978,6 +994,7 @@ public class LocationManager { @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION}) public void addProximityAlert(double latitude, double longitude, float radius, long expiration, PendingIntent intent) { + android.util.SeempLog.record(58); checkPendingIntent(intent); if (expiration < 0) expiration = Long.MAX_VALUE; @@ -1137,6 +1154,7 @@ public class LocationManager { * @throws IllegalArgumentException if provider is null */ public boolean isProviderEnabled(String provider) { + android.util.SeempLog.record(63); checkProvider(provider); try { @@ -1191,6 +1209,7 @@ public class LocationManager { */ @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION}) public Location getLastKnownLocation(String provider) { + android.util.SeempLog.record(60); checkProvider(provider); String packageName = mContext.getPackageName(); LocationRequest request = LocationRequest.createFromDeprecatedProvider( @@ -1511,6 +1530,7 @@ public class LocationManager { */ @RequiresPermission(ACCESS_FINE_LOCATION) public boolean addGpsStatusListener(GpsStatus.Listener listener) { + android.util.SeempLog.record(56); boolean result; if (mGpsStatusListeners.get(listener) != null) { @@ -1558,6 +1578,7 @@ public class LocationManager { */ @RequiresPermission(ACCESS_FINE_LOCATION) public boolean addNmeaListener(GpsStatus.NmeaListener listener) { + android.util.SeempLog.record(57); boolean result; if (mNmeaListeners.get(listener) != null) { @@ -1676,6 +1697,7 @@ public class LocationManager { * @return true if the command succeeds. */ public boolean sendExtraCommand(String provider, String command, Bundle extras) { + android.util.SeempLog.record(65); try { return mService.sendExtraCommand(provider, command, extras); } catch (RemoteException e) { |