blob: fafe99c9fe18a99eae3d4af6fe74f4a554985ce6 [file] [log] [blame]
Nick Pellye0fd6932012-07-11 10:26:13 -07001/*
Victoria Lease4cd0a502012-11-02 16:24:08 -07002 * Copyright (C) 2012 The Android Open Source Project
Nick Pellye0fd6932012-07-11 10:26:13 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.server.location;
18
19import java.io.PrintWriter;
20import java.util.Iterator;
21import java.util.LinkedList;
22import java.util.List;
23
Dianne Hackborn5e45ee62013-01-24 19:13:44 -080024import android.app.AppOpsManager;
Nick Pellye0fd6932012-07-11 10:26:13 -070025import android.app.PendingIntent;
Lifu Tangc94ef4d2017-03-23 23:48:00 -070026import android.content.ContentResolver;
Nick Pellye0fd6932012-07-11 10:26:13 -070027import android.content.Context;
28import android.content.Intent;
Lifu Tangc94ef4d2017-03-23 23:48:00 -070029import android.database.ContentObserver;
Nick Pelly6fa9ad42012-07-16 12:18:23 -070030import android.location.Geofence;
Nick Pellye0fd6932012-07-11 10:26:13 -070031import android.location.Location;
32import android.location.LocationListener;
33import android.location.LocationManager;
Nick Pelly6fa9ad42012-07-16 12:18:23 -070034import android.location.LocationRequest;
Nick Pellye0fd6932012-07-11 10:26:13 -070035import android.os.Bundle;
Victoria Lease4cd0a502012-11-02 16:24:08 -070036import android.os.Handler;
37import android.os.Message;
Nick Pellye0fd6932012-07-11 10:26:13 -070038import android.os.PowerManager;
39import android.os.SystemClock;
Lifu Tangc94ef4d2017-03-23 23:48:00 -070040import android.os.UserHandle;
41import android.provider.Settings;
Victoria Lease4cd0a502012-11-02 16:24:08 -070042import android.util.Slog;
Nick Pelly4035f5a2012-08-17 14:43:49 -070043
44import com.android.server.LocationManagerService;
Lifu Tang519f0d02018-04-12 16:39:39 -070045import com.android.server.PendingIntentUtils;
Nick Pellye0fd6932012-07-11 10:26:13 -070046
47public class GeofenceManager implements LocationListener, PendingIntent.OnFinished {
Nick Pelly6fa9ad42012-07-16 12:18:23 -070048 private static final String TAG = "GeofenceManager";
Nick Pelly4035f5a2012-08-17 14:43:49 -070049 private static final boolean D = LocationManagerService.D;
Nick Pellye0fd6932012-07-11 10:26:13 -070050
Victoria Lease4cd0a502012-11-02 16:24:08 -070051 private static final int MSG_UPDATE_FENCES = 1;
52
Nick Pellye0fd6932012-07-11 10:26:13 -070053 /**
54 * Assume a maximum land speed, as a heuristic to throttle location updates.
55 * (Air travel should result in an airplane mode toggle which will
56 * force a new location update anyway).
57 */
Nick Pelly6fa9ad42012-07-16 12:18:23 -070058 private static final int MAX_SPEED_M_S = 100; // 360 km/hr (high speed train)
Nick Pellye0fd6932012-07-11 10:26:13 -070059
Victoria Lease4cd0a502012-11-02 16:24:08 -070060 /**
61 * Maximum age after which a location is no longer considered fresh enough to use.
62 */
63 private static final long MAX_AGE_NANOS = 5 * 60 * 1000000000L; // five minutes
64
65 /**
Lifu Tangc94ef4d2017-03-23 23:48:00 -070066 * The default value of most frequent update interval allowed.
Victoria Lease4cd0a502012-11-02 16:24:08 -070067 */
Lifu Tangc94ef4d2017-03-23 23:48:00 -070068 private static final long DEFAULT_MIN_INTERVAL_MS = 30 * 60 * 1000; // 30 minutes
Victoria Lease4cd0a502012-11-02 16:24:08 -070069
70 /**
71 * Least frequent update interval allowed.
72 */
73 private static final long MAX_INTERVAL_MS = 2 * 60 * 60 * 1000; // two hours
74
Nick Pelly6fa9ad42012-07-16 12:18:23 -070075 private final Context mContext;
76 private final LocationManager mLocationManager;
Dianne Hackborn5e45ee62013-01-24 19:13:44 -080077 private final AppOpsManager mAppOps;
Nick Pelly6fa9ad42012-07-16 12:18:23 -070078 private final PowerManager.WakeLock mWakeLock;
Victoria Lease4cd0a502012-11-02 16:24:08 -070079 private final GeofenceHandler mHandler;
Nick Pelly4035f5a2012-08-17 14:43:49 -070080 private final LocationBlacklist mBlacklist;
Nick Pellye0fd6932012-07-11 10:26:13 -070081
Nick Pelly6fa9ad42012-07-16 12:18:23 -070082 private Object mLock = new Object();
Nick Pellye0fd6932012-07-11 10:26:13 -070083
Nick Pelly6fa9ad42012-07-16 12:18:23 -070084 // access to members below is synchronized on mLock
Victoria Lease4cd0a502012-11-02 16:24:08 -070085 /**
86 * A list containing all registered geofences.
87 */
Nick Pelly6fa9ad42012-07-16 12:18:23 -070088 private List<GeofenceState> mFences = new LinkedList<GeofenceState>();
Nick Pellye0fd6932012-07-11 10:26:13 -070089
Victoria Lease4cd0a502012-11-02 16:24:08 -070090 /**
91 * This is set true when we have an active request for {@link Location} updates via
92 * {@link LocationManager#requestLocationUpdates(LocationRequest, LocationListener,
93 * android.os.Looper).
94 */
95 private boolean mReceivingLocationUpdates;
96
97 /**
98 * The update interval component of the current active {@link Location} update request.
99 */
100 private long mLocationUpdateInterval;
101
102 /**
103 * The {@link Location} most recently received via {@link #onLocationChanged(Location)}.
104 */
105 private Location mLastLocationUpdate;
106
107 /**
108 * This is set true when a {@link Location} is received via
109 * {@link #onLocationChanged(Location)} or {@link #scheduleUpdateFencesLocked()}, and cleared
110 * when that Location has been processed via {@link #updateFences()}
111 */
112 private boolean mPendingUpdate;
113
Lifu Tangc94ef4d2017-03-23 23:48:00 -0700114 /**
115 * The actual value of most frequent update interval allowed.
116 */
117 private long mEffectiveMinIntervalMs;
118 private ContentResolver mResolver;
119
Nick Pelly4035f5a2012-08-17 14:43:49 -0700120 public GeofenceManager(Context context, LocationBlacklist blacklist) {
Nick Pellye0fd6932012-07-11 10:26:13 -0700121 mContext = context;
122 mLocationManager = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE);
Dianne Hackborn5e45ee62013-01-24 19:13:44 -0800123 mAppOps = (AppOpsManager)mContext.getSystemService(Context.APP_OPS_SERVICE);
Nick Pellye0fd6932012-07-11 10:26:13 -0700124 PowerManager powerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
125 mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
Victoria Lease4cd0a502012-11-02 16:24:08 -0700126 mHandler = new GeofenceHandler();
Nick Pelly4035f5a2012-08-17 14:43:49 -0700127 mBlacklist = blacklist;
Lifu Tangc94ef4d2017-03-23 23:48:00 -0700128 mResolver = mContext.getContentResolver();
129 updateMinInterval();
130 mResolver.registerContentObserver(
131 Settings.Global.getUriFor(
132 Settings.Global.LOCATION_BACKGROUND_THROTTLE_PROXIMITY_ALERT_INTERVAL_MS),
133 true,
134 new ContentObserver(mHandler) {
135 @Override
136 public void onChange(boolean selfChange) {
137 synchronized (mLock) {
138 updateMinInterval();
139 }
140 }
141 }, UserHandle.USER_ALL);
142 }
143
144 /**
145 * Updates the minimal location request frequency.
146 */
147 private void updateMinInterval() {
148 mEffectiveMinIntervalMs = Settings.Global.getLong(mResolver,
Lifu Tangff2f40f2017-10-31 16:29:35 -0700149 Settings.Global.LOCATION_BACKGROUND_THROTTLE_PROXIMITY_ALERT_INTERVAL_MS,
150 DEFAULT_MIN_INTERVAL_MS);
Nick Pellye0fd6932012-07-11 10:26:13 -0700151 }
152
Victoria Lease4cd0a502012-11-02 16:24:08 -0700153 public void addFence(LocationRequest request, Geofence geofence, PendingIntent intent,
Dianne Hackborn5e45ee62013-01-24 19:13:44 -0800154 int allowedResolutionLevel, int uid, String packageName) {
Victoria Lease4cd0a502012-11-02 16:24:08 -0700155 if (D) {
156 Slog.d(TAG, "addFence: request=" + request + ", geofence=" + geofence
157 + ", intent=" + intent + ", uid=" + uid + ", packageName=" + packageName);
158 }
Nick Pellye0fd6932012-07-11 10:26:13 -0700159
Victoria Lease4cd0a502012-11-02 16:24:08 -0700160 GeofenceState state = new GeofenceState(geofence,
Dianne Hackborn5e45ee62013-01-24 19:13:44 -0800161 request.getExpireAt(), allowedResolutionLevel, uid, packageName, intent);
Nick Pelly6fa9ad42012-07-16 12:18:23 -0700162 synchronized (mLock) {
163 // first make sure it doesn't already exist
164 for (int i = mFences.size() - 1; i >= 0; i--) {
165 GeofenceState w = mFences.get(i);
166 if (geofence.equals(w.mFence) && intent.equals(w.mIntent)) {
167 // already exists, remove the old one
168 mFences.remove(i);
169 break;
Nick Pellye0fd6932012-07-11 10:26:13 -0700170 }
171 }
Nick Pelly6fa9ad42012-07-16 12:18:23 -0700172 mFences.add(state);
Victoria Lease4cd0a502012-11-02 16:24:08 -0700173 scheduleUpdateFencesLocked();
Nick Pelly6fa9ad42012-07-16 12:18:23 -0700174 }
175 }
176
177 public void removeFence(Geofence fence, PendingIntent intent) {
Victoria Lease4cd0a502012-11-02 16:24:08 -0700178 if (D) {
179 Slog.d(TAG, "removeFence: fence=" + fence + ", intent=" + intent);
180 }
181
Nick Pelly6fa9ad42012-07-16 12:18:23 -0700182 synchronized (mLock) {
183 Iterator<GeofenceState> iter = mFences.iterator();
184 while (iter.hasNext()) {
185 GeofenceState state = iter.next();
186 if (state.mIntent.equals(intent)) {
187
188 if (fence == null) {
Victoria Lease4cd0a502012-11-02 16:24:08 -0700189 // always remove
Nick Pelly6fa9ad42012-07-16 12:18:23 -0700190 iter.remove();
191 } else {
192 // just remove matching fences
193 if (fence.equals(state.mFence)) {
194 iter.remove();
195 }
196 }
197 }
198 }
Victoria Lease4cd0a502012-11-02 16:24:08 -0700199 scheduleUpdateFencesLocked();
Nick Pellye0fd6932012-07-11 10:26:13 -0700200 }
201 }
202
203 public void removeFence(String packageName) {
Victoria Lease4cd0a502012-11-02 16:24:08 -0700204 if (D) {
205 Slog.d(TAG, "removeFence: packageName=" + packageName);
206 }
207
Nick Pelly6fa9ad42012-07-16 12:18:23 -0700208 synchronized (mLock) {
209 Iterator<GeofenceState> iter = mFences.iterator();
Nick Pellye0fd6932012-07-11 10:26:13 -0700210 while (iter.hasNext()) {
Nick Pelly6fa9ad42012-07-16 12:18:23 -0700211 GeofenceState state = iter.next();
212 if (state.mPackageName.equals(packageName)) {
Nick Pellye0fd6932012-07-11 10:26:13 -0700213 iter.remove();
214 }
215 }
Victoria Lease4cd0a502012-11-02 16:24:08 -0700216 scheduleUpdateFencesLocked();
Nick Pellye0fd6932012-07-11 10:26:13 -0700217 }
218 }
219
Nick Pelly6fa9ad42012-07-16 12:18:23 -0700220 private void removeExpiredFencesLocked() {
221 long time = SystemClock.elapsedRealtime();
222 Iterator<GeofenceState> iter = mFences.iterator();
223 while (iter.hasNext()) {
224 GeofenceState state = iter.next();
225 if (state.mExpireAt < time) {
226 iter.remove();
Nick Pellye0fd6932012-07-11 10:26:13 -0700227 }
228 }
229 }
230
Victoria Lease4cd0a502012-11-02 16:24:08 -0700231 private void scheduleUpdateFencesLocked() {
232 if (!mPendingUpdate) {
233 mPendingUpdate = true;
234 mHandler.sendEmptyMessage(MSG_UPDATE_FENCES);
235 }
236 }
237
238 /**
239 * Returns the location received most recently from {@link #onLocationChanged(Location)},
240 * or consult {@link LocationManager#getLastLocation()} if none has arrived. Does not return
241 * either if the location would be too stale to be useful.
242 *
243 * @return a fresh, valid Location, or null if none is available
244 */
245 private Location getFreshLocationLocked() {
246 // Prefer mLastLocationUpdate to LocationManager.getLastLocation().
247 Location location = mReceivingLocationUpdates ? mLastLocationUpdate : null;
248 if (location == null && !mFences.isEmpty()) {
249 location = mLocationManager.getLastLocation();
250 }
251
252 // Early out for null location.
253 if (location == null) {
254 return null;
255 }
256
257 // Early out for stale location.
258 long now = SystemClock.elapsedRealtimeNanos();
259 if (now - location.getElapsedRealtimeNanos() > MAX_AGE_NANOS) {
260 return null;
261 }
262
263 // Made it this far? Return our fresh, valid location.
264 return location;
265 }
266
267 /**
268 * The geofence update loop. This function removes expired fences, then tests the most
269 * recently-received {@link Location} against each registered {@link GeofenceState}, sending
270 * {@link Intent}s for geofences that have been tripped. It also adjusts the active location
271 * update request with {@link LocationManager} as appropriate for any active geofences.
272 */
273 // Runs on the handler.
274 private void updateFences() {
Nick Pellye0fd6932012-07-11 10:26:13 -0700275 List<PendingIntent> enterIntents = new LinkedList<PendingIntent>();
276 List<PendingIntent> exitIntents = new LinkedList<PendingIntent>();
277
Nick Pelly6fa9ad42012-07-16 12:18:23 -0700278 synchronized (mLock) {
Victoria Lease4cd0a502012-11-02 16:24:08 -0700279 mPendingUpdate = false;
280
281 // Remove expired fences.
Nick Pelly6fa9ad42012-07-16 12:18:23 -0700282 removeExpiredFencesLocked();
Nick Pellye0fd6932012-07-11 10:26:13 -0700283
Victoria Lease4cd0a502012-11-02 16:24:08 -0700284 // Get a location to work with, either received via onLocationChanged() or
285 // via LocationManager.getLastLocation().
286 Location location = getFreshLocationLocked();
287
288 // Update all fences.
289 // Keep track of the distance to the nearest fence.
290 double minFenceDistance = Double.MAX_VALUE;
291 boolean needUpdates = false;
Nick Pelly6fa9ad42012-07-16 12:18:23 -0700292 for (GeofenceState state : mFences) {
Nick Pelly4035f5a2012-08-17 14:43:49 -0700293 if (mBlacklist.isBlacklisted(state.mPackageName)) {
Victoria Lease4cd0a502012-11-02 16:24:08 -0700294 if (D) {
295 Slog.d(TAG, "skipping geofence processing for blacklisted app: "
296 + state.mPackageName);
297 }
Nick Pelly4035f5a2012-08-17 14:43:49 -0700298 continue;
299 }
300
Dianne Hackborn5e45ee62013-01-24 19:13:44 -0800301 int op = LocationManagerService.resolutionLevelToOp(state.mAllowedResolutionLevel);
302 if (op >= 0) {
303 if (mAppOps.noteOpNoThrow(AppOpsManager.OP_FINE_LOCATION, state.mUid,
304 state.mPackageName) != AppOpsManager.MODE_ALLOWED) {
305 if (D) {
306 Slog.d(TAG, "skipping geofence processing for no op app: "
307 + state.mPackageName);
308 }
309 continue;
310 }
311 }
312
Victoria Lease4cd0a502012-11-02 16:24:08 -0700313 needUpdates = true;
314 if (location != null) {
315 int event = state.processLocation(location);
316 if ((event & GeofenceState.FLAG_ENTER) != 0) {
317 enterIntents.add(state.mIntent);
318 }
319 if ((event & GeofenceState.FLAG_EXIT) != 0) {
320 exitIntents.add(state.mIntent);
321 }
322
323 // FIXME: Ideally this code should take into account the accuracy of the
324 // location fix that was used to calculate the distance in the first place.
325 double fenceDistance = state.getDistanceToBoundary(); // MAX_VALUE if unknown
326 if (fenceDistance < minFenceDistance) {
327 minFenceDistance = fenceDistance;
328 }
Nick Pellye0fd6932012-07-11 10:26:13 -0700329 }
330 }
Victoria Lease4cd0a502012-11-02 16:24:08 -0700331
332 // Request or cancel location updates if needed.
333 if (needUpdates) {
334 // Request location updates.
335 // Compute a location update interval based on the distance to the nearest fence.
336 long intervalMs;
337 if (location != null && Double.compare(minFenceDistance, Double.MAX_VALUE) != 0) {
Lifu Tangc94ef4d2017-03-23 23:48:00 -0700338 intervalMs = (long)Math.min(MAX_INTERVAL_MS, Math.max(mEffectiveMinIntervalMs,
Victoria Lease4cd0a502012-11-02 16:24:08 -0700339 minFenceDistance * 1000 / MAX_SPEED_M_S));
340 } else {
Lifu Tangc94ef4d2017-03-23 23:48:00 -0700341 intervalMs = mEffectiveMinIntervalMs;
Victoria Lease4cd0a502012-11-02 16:24:08 -0700342 }
343 if (!mReceivingLocationUpdates || mLocationUpdateInterval != intervalMs) {
344 mReceivingLocationUpdates = true;
345 mLocationUpdateInterval = intervalMs;
346 mLastLocationUpdate = location;
347
348 LocationRequest request = new LocationRequest();
349 request.setInterval(intervalMs).setFastestInterval(0);
350 mLocationManager.requestLocationUpdates(request, this, mHandler.getLooper());
351 }
352 } else {
353 // Cancel location updates.
354 if (mReceivingLocationUpdates) {
355 mReceivingLocationUpdates = false;
356 mLocationUpdateInterval = 0;
357 mLastLocationUpdate = null;
358
359 mLocationManager.removeUpdates(this);
360 }
361 }
362
363 if (D) {
364 Slog.d(TAG, "updateFences: location=" + location
365 + ", mFences.size()=" + mFences.size()
366 + ", mReceivingLocationUpdates=" + mReceivingLocationUpdates
367 + ", mLocationUpdateInterval=" + mLocationUpdateInterval
368 + ", mLastLocationUpdate=" + mLastLocationUpdate);
369 }
Nick Pellye0fd6932012-07-11 10:26:13 -0700370 }
371
372 // release lock before sending intents
373 for (PendingIntent intent : exitIntents) {
374 sendIntentExit(intent);
375 }
376 for (PendingIntent intent : enterIntents) {
377 sendIntentEnter(intent);
378 }
379 }
380
Nick Pelly6fa9ad42012-07-16 12:18:23 -0700381 private void sendIntentEnter(PendingIntent pendingIntent) {
Victoria Lease4cd0a502012-11-02 16:24:08 -0700382 if (D) {
383 Slog.d(TAG, "sendIntentEnter: pendingIntent=" + pendingIntent);
384 }
385
Nick Pellye0fd6932012-07-11 10:26:13 -0700386 Intent intent = new Intent();
387 intent.putExtra(LocationManager.KEY_PROXIMITY_ENTERING, true);
388 sendIntent(pendingIntent, intent);
389 }
390
Nick Pelly6fa9ad42012-07-16 12:18:23 -0700391 private void sendIntentExit(PendingIntent pendingIntent) {
Victoria Lease4cd0a502012-11-02 16:24:08 -0700392 if (D) {
393 Slog.d(TAG, "sendIntentExit: pendingIntent=" + pendingIntent);
394 }
395
Nick Pellye0fd6932012-07-11 10:26:13 -0700396 Intent intent = new Intent();
397 intent.putExtra(LocationManager.KEY_PROXIMITY_ENTERING, false);
398 sendIntent(pendingIntent, intent);
399 }
400
Nick Pelly6fa9ad42012-07-16 12:18:23 -0700401 private void sendIntent(PendingIntent pendingIntent, Intent intent) {
Victoria Lease4cd0a502012-11-02 16:24:08 -0700402 mWakeLock.acquire();
Nick Pellye0fd6932012-07-11 10:26:13 -0700403 try {
Victoria Lease4cd0a502012-11-02 16:24:08 -0700404 pendingIntent.send(mContext, 0, intent, this, null,
Lifu Tang519f0d02018-04-12 16:39:39 -0700405 android.Manifest.permission.ACCESS_FINE_LOCATION,
406 PendingIntentUtils.createDontSendToRestrictedAppsBundle(null));
Nick Pellye0fd6932012-07-11 10:26:13 -0700407 } catch (PendingIntent.CanceledException e) {
Nick Pelly6fa9ad42012-07-16 12:18:23 -0700408 removeFence(null, pendingIntent);
Nick Pellye0fd6932012-07-11 10:26:13 -0700409 mWakeLock.release();
410 }
Victoria Lease4cd0a502012-11-02 16:24:08 -0700411 // ...otherwise, mWakeLock.release() gets called by onSendFinished()
Nick Pellye0fd6932012-07-11 10:26:13 -0700412 }
413
Victoria Lease4cd0a502012-11-02 16:24:08 -0700414 // Runs on the handler (which was passed into LocationManager.requestLocationUpdates())
Nick Pellye0fd6932012-07-11 10:26:13 -0700415 @Override
416 public void onLocationChanged(Location location) {
Victoria Lease4cd0a502012-11-02 16:24:08 -0700417 synchronized (mLock) {
418 if (mReceivingLocationUpdates) {
419 mLastLocationUpdate = location;
420 }
421
422 // Update the fences immediately before returning in
423 // case the caller is holding a wakelock.
424 if (mPendingUpdate) {
425 mHandler.removeMessages(MSG_UPDATE_FENCES);
426 } else {
427 mPendingUpdate = true;
428 }
429 }
430 updateFences();
Nick Pellye0fd6932012-07-11 10:26:13 -0700431 }
432
433 @Override
434 public void onStatusChanged(String provider, int status, Bundle extras) { }
435
436 @Override
437 public void onProviderEnabled(String provider) { }
438
439 @Override
440 public void onProviderDisabled(String provider) { }
441
442 @Override
443 public void onSendFinished(PendingIntent pendingIntent, Intent intent, int resultCode,
444 String resultData, Bundle resultExtras) {
445 mWakeLock.release();
446 }
447
448 public void dump(PrintWriter pw) {
449 pw.println(" Geofences:");
Nick Pelly6fa9ad42012-07-16 12:18:23 -0700450
451 for (GeofenceState state : mFences) {
Nick Pellye0fd6932012-07-11 10:26:13 -0700452 pw.append(" ");
Nick Pelly6fa9ad42012-07-16 12:18:23 -0700453 pw.append(state.mPackageName);
Nick Pellye0fd6932012-07-11 10:26:13 -0700454 pw.append(" ");
Nick Pelly6fa9ad42012-07-16 12:18:23 -0700455 pw.append(state.mFence.toString());
Nick Pellye0fd6932012-07-11 10:26:13 -0700456 pw.append("\n");
457 }
458 }
Victoria Lease4cd0a502012-11-02 16:24:08 -0700459
460 private final class GeofenceHandler extends Handler {
461 public GeofenceHandler() {
462 super(true /*async*/);
463 }
464
465 @Override
466 public void handleMessage(Message msg) {
467 switch (msg.what) {
468 case MSG_UPDATE_FENCES: {
469 updateFences();
470 break;
471 }
472 }
473 }
474 }
Nick Pellye0fd6932012-07-11 10:26:13 -0700475}