diff options
Diffstat (limited to 'location')
-rw-r--r-- | location/data/Android.mk | 53 | ||||
-rw-r--r-- | location/data/kml/kml | 2 | ||||
-rw-r--r-- | location/data/kml/properties | 11 | ||||
-rw-r--r-- | location/data/location | 1 | ||||
-rw-r--r-- | location/data/nmea | 162 | ||||
-rw-r--r-- | location/data/properties | 10 | ||||
-rw-r--r-- | location/data/test/class | 1 | ||||
-rw-r--r-- | location/data/track/properties | 10 | ||||
-rw-r--r-- | location/data/track/track | 1 | ||||
-rw-r--r-- | location/java/android/location/LocationManager.java | 3 | ||||
-rw-r--r-- | location/java/com/android/internal/location/LocationProviderImpl.java | 48 | ||||
-rw-r--r-- | location/java/com/android/internal/location/TrackProvider.java | 731 |
12 files changed, 0 insertions, 1033 deletions
diff --git a/location/data/Android.mk b/location/data/Android.mk deleted file mode 100644 index 794e6c7..0000000 --- a/location/data/Android.mk +++ /dev/null @@ -1,53 +0,0 @@ -# -# Install 3 sample gps files (nmea, location, and properties) -# for use with the SDK -# - -# where to install the sample files on the device -# -local_target_dir := $(TARGET_OUT_DATA)/location - -######################## -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE := nmea - -LOCAL_MODULE_TAGS := tests - -LOCAL_MODULE_CLASS := ETC -LOCAL_MODULE_PATH := $(local_target_dir)/gps - -LOCAL_SRC_FILES := $(LOCAL_MODULE) - -include $(BUILD_PREBUILT) - -######################## -include $(CLEAR_VARS) - -LOCAL_MODULE := location - -LOCAL_MODULE_TAGS := tests - -LOCAL_MODULE_CLASS := ETC -LOCAL_MODULE_PATH := $(local_target_dir)/gps - -LOCAL_SRC_FILES := $(LOCAL_MODULE) - -include $(BUILD_PREBUILT) - -######################## -include $(CLEAR_VARS) - -LOCAL_MODULE := properties - -LOCAL_MODULE_TAGS := tests - -LOCAL_MODULE_CLASS := ETC -LOCAL_MODULE_PATH := $(local_target_dir)/gps - -LOCAL_SRC_FILES := $(LOCAL_MODULE) - -include $(BUILD_PREBUILT) - -######################## diff --git a/location/data/kml/kml b/location/data/kml/kml deleted file mode 100644 index e1d98b8..0000000 --- a/location/data/kml/kml +++ /dev/null @@ -1,2 +0,0 @@ -<coordinates>003405.000,3725.3433,12205.7921 003405.000,3725.3433,12205.7921</coordinates> -<coordinates>003405.000,3725.3433,12205.7921 003405.000,3725.3433,12205.7921</coordinates> diff --git a/location/data/kml/properties b/location/data/kml/properties deleted file mode 100644 index 42d319f..0000000 --- a/location/data/kml/properties +++ /dev/null @@ -1,11 +0,0 @@ -requiresNetwork false -requiresSatellite false -requiresCell true -hasMonetaryCost false -supportsAltitude true -supportsBearing false -supportsSpeed true -repeat true -accuracy 2 -powerRequirement 2 -trackSpeed 100 diff --git a/location/data/location b/location/data/location deleted file mode 100644 index 1c0c986..0000000 --- a/location/data/location +++ /dev/null @@ -1 +0,0 @@ -gps,1193789209,37.42238666666666666666,-122.096535,0,0,0 diff --git a/location/data/nmea b/location/data/nmea deleted file mode 100644 index 1b6b45b..0000000 --- a/location/data/nmea +++ /dev/null @@ -1,162 +0,0 @@ -$GPRMC,003350.000,A,3725.3432,N,12205.7921,W,0.06,151.59,061007,,,D*7F -$GPRMC,003355.000,A,3725.3430,N,12205.7920,W,0.18,109.49,061007,,,D*7A -$GPRMC,003400.000,A,3725.3433,N,12205.7921,W,0.02,227.11,061007,,,D*76 -$GPRMC,003405.000,A,3725.3433,N,12205.7921,W,0.17,103.32,061007,,,D*73 -$GPRMC,003410.000,A,3725.3431,N,12205.7921,W,0.22,167.43,061007,,,D*77 -$GPRMC,003415.000,A,3725.3427,N,12205.7921,W,0.23,246.49,061007,,,D*7E -$GPRMC,003420.000,A,3725.3423,N,12205.7917,W,0.16,74.88,061007,,,D*41 -$GPRMC,003425.000,A,3725.3426,N,12205.7919,W,0.05,124.94,061007,,,D*74 -$GPRMC,003430.000,A,3725.3429,N,12205.7919,W,0.15,77.12,061007,,,D*47 -$GPRMC,003435.000,A,3725.3432,N,12205.7921,W,0.07,94.72,061007,,,D*4B -$GPRMC,003440.000,A,3725.3436,N,12205.7921,W,0.13,336.72,061007,,,D*73 -$GPRMC,003445.000,A,3725.3440,N,12205.7953,W,2.72,278.90,061007,,,D*70 -$GPRMC,003450.000,A,3725.3442,N,12205.7977,W,2.02,164.81,061007,,,D*79 -$GPRMC,003455.000,A,3725.3380,N,12205.8008,W,8.28,200.23,061007,,,D*70 -$GPRMC,003500.000,A,3725.3207,N,12205.8057,W,14.04,189.77,061007,,,D*45 -$GPRMC,003505.000,A,3725.3032,N,12205.8094,W,11.67,205.32,061007,,,D*4D -$GPRMC,003510.000,A,3725.2988,N,12205.8295,W,17.09,271.31,061007,,,D*4D -$GPRMC,003515.000,A,3725.3005,N,12205.8672,W,25.02,273.74,061007,,,D*41 -$GPRMC,003520.000,A,3725.3030,N,12205.9159,W,29.84,273.27,061007,,,D*4A -$GPRMC,003525.000,A,3725.3061,N,12205.9683,W,28.20,274.26,061007,,,D*42 -$GPRMC,003530.000,A,3725.3092,N,12206.0150,W,25.25,274.96,061007,,,D*4A -$GPRMC,003535.000,A,3725.3124,N,12206.0503,W,12.55,276.56,061007,,,D*4C -$GPRMC,003540.000,A,3725.3135,N,12206.0637,W,3.99,272.32,061007,,,D*7C -$GPRMC,003545.000,A,3725.3140,N,12206.0701,W,2.80,273.59,061007,,,D*7A -$GPRMC,003550.000,A,3725.3143,N,12206.0734,W,0.84,266.99,061007,,,D*75 -$GPRMC,003555.000,A,3725.3142,N,12206.0731,W,0.13,157.63,061007,,,D*7E -$GPRMC,003600.000,A,3725.3142,N,12206.0729,W,0.16,239.76,061007,,,D*7E -$GPRMC,003605.000,A,3725.3141,N,12206.0726,W,0.15,199.57,061007,,,D*7E -$GPRMC,003610.000,A,3725.3141,N,12206.0724,W,0.07,161.75,061007,,,D*7C -$GPRMC,003615.000,A,3725.3141,N,12206.0721,W,0.14,171.95,061007,,,D*71 -$GPRMC,003620.000,A,3725.3141,N,12206.0718,W,0.12,188.87,061007,,,D*7E -$GPRMC,003625.000,A,3725.3141,N,12206.0716,W,0.14,164.43,061007,,,D*79 -$GPRMC,003630.000,A,3725.3141,N,12206.0714,W,0.10,186.09,061007,,,D*79 -$GPRMC,003635.000,A,3725.3142,N,12206.0716,W,0.09,224.65,061007,,,D*74 -$GPRMC,003640.000,A,3725.3142,N,12206.0716,W,0.09,187.23,061007,,,D*7E -$GPRMC,003645.000,A,3725.3143,N,12206.0716,W,0.14,229.41,061007,,,D*75 -$GPRMC,003650.000,A,3725.3143,N,12206.0716,W,0.14,195.40,061007,,,D*74 -$GPRMC,003655.000,A,3725.3143,N,12206.0716,W,0.51,267.41,061007,,,D*7F -$GPRMC,003700.000,A,3725.3148,N,12206.0813,W,9.83,274.54,061007,,,D*7F -$GPRMC,003705.000,A,3725.3247,N,12206.0930,W,15.25,357.95,061007,,,D*4A -$GPRMC,003710.000,A,3725.3558,N,12206.0907,W,27.03,4.83,061007,,,D*44 -$GPRMC,003715.000,A,3725.3993,N,12206.0862,W,34.76,4.78,061007,,,D*4C -$GPRMC,003720.000,A,3725.4514,N,12206.0802,W,39.38,5.62,061007,,,D*45 -$GPRMC,003725.000,A,3725.5072,N,12206.0756,W,38.59,358.11,061007,,,D*43 -$GPRMC,003730.000,A,3725.5581,N,12206.0877,W,36.13,344.59,061007,,,D*43 -$GPRMC,003735.000,A,3725.6078,N,12206.1038,W,36.78,348.75,061007,,,D*4B -$GPRMC,003740.000,A,3725.6604,N,12206.1021,W,37.66,14.75,061007,,,D*78 -$GPRMC,003745.000,A,3725.7064,N,12206.0817,W,32.70,20.79,061007,,,D*79 -$GPRMC,003750.000,A,3725.7482,N,12206.0613,W,31.70,20.73,061007,,,D*72 -$GPRMC,003755.000,A,3725.7841,N,12206.0458,W,25.05,16.94,061007,,,D*72 -$GPRMC,003800.000,A,3725.8137,N,12206.0368,W,16.01,11.76,061007,,,D*71 -$GPRMC,003805.000,A,3725.8266,N,12206.0341,W,2.45,9.89,061007,,,D*74 -$GPRMC,003810.000,A,3725.8273,N,12206.0340,W,1.42,8.42,061007,,,D*77 -$GPRMC,003815.000,A,3725.8287,N,12206.0340,W,3.02,8.77,061007,,,D*79 -$GPRMC,003820.000,A,3725.8402,N,12206.0321,W,11.90,7.87,061007,,,D*4B -$GPRMC,003825.000,A,3725.8520,N,12206.0422,W,12.90,274.31,061007,,,D*43 -$GPRMC,003830.000,A,3725.8386,N,12206.0610,W,17.45,193.03,061007,,,D*48 -$GPRMC,003835.000,A,3725.8082,N,12206.0693,W,25.06,193.69,061007,,,D*4B -$GPRMC,003840.000,A,3725.7732,N,12206.0836,W,24.74,216.89,061007,,,D*4F -$GPRMC,003845.000,A,3725.7672,N,12206.1208,W,23.64,296.05,061007,,,D*43 -$GPRMC,003850.000,A,3725.7944,N,12206.1530,W,30.80,314.88,061007,,,D*47 -$GPRMC,003855.000,A,3725.8272,N,12206.1893,W,31.57,318.18,061007,,,D*49 -$GPRMC,003900.000,A,3725.8605,N,12206.2264,W,31.13,318.65,061007,,,D*47 -$GPRMC,003905.000,A,3725.8939,N,12206.2625,W,32.39,318.52,061007,,,A*49 -$GPRMC,003910.000,A,3725.9297,N,12206.2994,W,33.37,319.89,061007,,,A*4E -$GPRMC,003915.000,A,3725.9666,N,12206.3378,W,34.92,320.36,061007,,,A*4E -$GPRMC,003920.000,A,3726.0048,N,12206.3777,W,35.91,319.96,061007,,,A*41 -$GPRMC,003925.000,A,3726.0439,N,12206.4186,W,36.78,319.98,061007,,,A*43 -$GPRMC,003930.000,A,3726.0837,N,12206.4602,W,37.26,320.27,061007,,,A*4A -$GPRMC,003935.000,A,3726.1240,N,12206.5024,W,37.88,320.27,061007,,,A*43 -$GPRMC,003940.000,A,3726.1647,N,12206.5449,W,37.95,319.99,061007,,,A*4E -$GPRMC,003945.000,A,3726.2055,N,12206.5874,W,37.24,320.06,061007,,,A*49 -$GPRMC,003950.000,A,3726.2438,N,12206.6274,W,34.50,320.25,061007,,,A*4A -$GPRMC,003955.000,A,3726.2805,N,12206.6661,W,34.75,319.90,061007,,,A*4E -$GPRMC,004000.000,A,3726.3181,N,12206.7054,W,35.63,320.23,061007,,,A*41 -$GPRMC,004005.000,A,3726.3570,N,12206.7462,W,36.84,320.29,061007,,,A*4F -$GPRMC,004010.000,A,3726.3961,N,12206.7872,W,35.85,320.09,061007,,,A*4A -$GPRMC,004015.000,A,3726.4343,N,12206.8276,W,36.84,320.17,061007,,,A*4E -$GPRMC,004020.000,A,3726.4759,N,12206.8712,W,40.53,320.65,061007,,,A*4E -$GPRMC,004025.000,A,3726.5190,N,12206.9164,W,39.54,320.13,061007,,,A*47 -$GPRMC,004030.000,A,3726.5607,N,12206.9605,W,38.84,319.99,061007,,,A*4E -$GPRMC,004035.000,A,3726.6010,N,12207.0030,W,36.82,320.30,061007,,,A*41 -$GPRMC,004040.000,A,3726.6413,N,12207.0416,W,35.63,328.90,061007,,,A*4A -$GPRMC,004045.000,A,3726.6861,N,12207.0652,W,35.49,342.93,061007,,,A*43 -$GPRMC,004050.000,A,3726.7346,N,12207.0842,W,37.15,342.57,061007,,,A*44 -$GPRMC,004055.000,A,3726.7834,N,12207.1033,W,36.68,342.14,061007,,,A*4C -$GPRMC,004100.000,A,3726.8328,N,12207.1225,W,36.73,343.04,061007,,,D*4E -$GPRMC,004105.000,A,3726.8795,N,12207.1405,W,33.44,343.08,061007,,,D*40 -$GPRMC,004110.000,A,3726.9211,N,12207.1570,W,28.00,343.17,061007,,,D*4B -$GPRMC,004115.000,A,3726.9507,N,12207.1678,W,18.59,345.92,061007,,,D*41 -$GPRMC,004120.000,A,3726.9639,N,12207.1722,W,3.24,343.37,061007,,,D*7E -$GPRMC,004125.000,A,3726.9641,N,12207.1725,W,0.21,154.73,061007,,,D*71 -$GPRMC,004130.000,A,3726.9634,N,12207.1722,W,0.16,105.89,061007,,,D*75 -$GPRMC,004135.000,A,3726.9630,N,12207.1720,W,0.04,133.97,061007,,,D*7F -$GPRMC,004140.000,A,3726.9627,N,12207.1718,W,0.16,107.47,061007,,,D*79 -$GPRMC,004145.000,A,3726.9625,N,12207.1716,W,0.14,148.73,061007,,,D*7E -$GPRMC,004150.000,A,3726.9621,N,12207.1715,W,0.09,142.18,061007,,,D*76 -$GPRMC,004155.000,A,3726.9620,N,12207.1714,W,0.10,95.75,061007,,,D*4B -$GPRMC,004200.000,A,3726.9618,N,12207.1714,W,0.07,135.28,061007,,,D*76 -$GPRMC,004205.000,A,3726.9617,N,12207.1713,W,0.14,86.20,061007,,,D*48 -$GPRMC,004210.000,A,3726.9616,N,12207.1713,W,0.05,130.34,061007,,,D*74 -$GPRMC,004215.000,A,3726.9614,N,12207.1714,W,0.08,120.53,061007,,,D*79 -$GPRMC,004220.000,A,3726.9612,N,12207.1714,W,0.09,147.27,061007,,,D*7A -$GPRMC,004225.000,A,3726.9612,N,12207.1715,W,0.12,118.20,061007,,,D*79 -$GPRMC,004230.000,A,3726.9612,N,12207.1714,W,0.12,90.61,061007,,,D*48 -$GPRMC,004235.000,A,3726.9612,N,12207.1715,W,0.10,156.15,061007,,,D*76 -$GPRMC,004240.000,A,3726.9612,N,12207.1715,W,0.13,104.74,061007,,,D*77 -$GPRMC,004245.000,A,3726.9617,N,12207.1716,W,2.21,343.16,061007,,,D*72 -$GPRMC,004250.000,A,3726.9756,N,12207.1772,W,15.37,342.52,061007,,,D*40 -$GPRMC,004255.000,A,3726.9950,N,12207.1942,W,16.40,298.08,061007,,,D*4A -$GPRMC,004300.000,A,3726.9896,N,12207.2215,W,18.97,241.60,061007,,,D*44 -$GPRMC,004305.000,A,3726.9801,N,12207.2558,W,22.01,268.09,061007,,,D*43 -$GPRMC,004310.000,A,3726.9908,N,12207.2943,W,24.76,304.28,061007,,,D*47 -$GPRMC,004315.000,A,3727.0088,N,12207.3347,W,27.35,295.83,061007,,,D*48 -$GPRMC,004320.000,A,3727.0117,N,12207.3855,W,28.97,271.02,061007,,,D*45 -$GPRMC,004325.000,A,3727.0211,N,12207.4306,W,22.94,303.62,061007,,,D*44 -$GPRMC,004330.000,A,3727.0358,N,12207.4491,W,8.59,313.76,061007,,,D*78 -$GPRMC,004335.000,A,3727.0409,N,12207.4550,W,2.33,313.55,061007,,,D*75 -$GPRMC,004340.000,A,3727.0433,N,12207.4578,W,5.75,314.25,061007,,,D*71 -$GPRMC,004345.000,A,3727.0533,N,12207.4704,W,12.55,314.18,061007,,,D*46 -$GPRMC,004350.000,A,3727.0676,N,12207.4892,W,16.68,312.98,061007,,,D*44 -$GPRMC,004355.000,A,3727.0835,N,12207.5103,W,15.11,313.21,061007,,,D*46 -$GPRMC,004400.000,A,3727.0969,N,12207.5285,W,10.26,312.85,061007,,,D*4A -$GPRMC,004405.000,A,3727.1006,N,12207.5334,W,0.33,319.16,061007,,,D*71 -$GPRMC,004410.000,A,3727.1007,N,12207.5333,W,0.19,144.98,061007,,,D*77 -$GPRMC,004415.000,A,3727.1005,N,12207.5330,W,0.05,106.63,061007,,,D*7C -$GPRMC,004420.000,A,3727.1006,N,12207.5327,W,0.05,92.53,061007,,,D*40 -$GPRMC,004425.000,A,3727.1005,N,12207.5323,W,0.17,148.57,061007,,,D*73 -$GPRMC,004430.000,A,3727.1037,N,12207.5355,W,8.70,314.52,061007,,,D*70 -$GPRMC,004435.000,A,3727.1168,N,12207.5516,W,16.83,312.51,061007,,,D*49 -$GPRMC,004440.000,A,3727.1344,N,12207.5787,W,23.06,309.71,061007,,,D*4E -$GPRMC,004445.000,A,3727.1572,N,12207.6136,W,27.67,308.29,061007,,,D*48 -$GPRMC,004450.000,A,3727.1821,N,12207.6558,W,31.56,306.08,061007,,,D*43 -$GPRMC,004455.000,A,3727.2083,N,12207.7008,W,30.81,306.19,061007,,,D*4F -$GPRMC,004500.000,A,3727.2324,N,12207.7424,W,27.68,306.75,061007,,,D*41 -$GPRMC,004505.000,A,3727.2519,N,12207.7754,W,16.50,305.19,061007,,,D*48 -$GPRMC,004510.000,A,3727.2570,N,12207.7849,W,0.13,151.16,061007,,,D*7C -$GPRMC,004515.000,A,3727.2619,N,12207.7927,W,14.27,311.27,061007,,,D*4A -$GPRMC,004520.000,A,3727.2786,N,12207.8214,W,23.53,303.48,061007,,,D*42 -$GPRMC,004525.000,A,3727.2980,N,12207.8564,W,25.03,306.82,061007,,,D*4F -$GPRMC,004530.000,A,3727.3199,N,12207.8936,W,27.48,306.29,061007,,,D*4D -$GPRMC,004535.000,A,3727.3433,N,12207.9339,W,28.66,306.28,061007,,,D*4B -$GPRMC,004540.000,A,3727.3666,N,12207.9740,W,28.04,306.12,061007,,,D*4C -$GPRMC,004545.000,A,3727.3886,N,12208.0118,W,25.22,306.50,061007,,,D*4B -$GPRMC,004550.000,A,3727.4091,N,12208.0461,W,23.34,306.68,061007,,,D*47 -$GPRMC,004555.000,A,3727.4291,N,12208.0747,W,19.76,317.26,061007,,,D*42 -$GPRMC,004600.000,A,3727.4497,N,12208.1015,W,24.00,309.28,061007,,,D*4E -$GPRMC,004605.000,A,3727.4711,N,12208.1376,W,26.83,305.61,061007,,,D*48 -$GPRMC,004610.000,A,3727.4937,N,12208.1760,W,26.40,305.68,061007,,,D*43 -$GPRMC,004615.000,A,3727.5142,N,12208.2112,W,23.46,306.19,061007,,,D*4B -$GPRMC,004620.000,A,3727.5326,N,12208.2431,W,21.96,304.30,061007,,,D*4F -$GPRMC,004625.000,A,3727.5515,N,12208.2693,W,20.21,323.71,061007,,,D*4B -$GPRMC,004630.000,A,3727.5788,N,12208.2812,W,21.00,352.36,061007,,,D*49 -$GPRMC,004635.000,A,3727.6048,N,12208.2846,W,14.79,351.69,061007,,,D*44 -$GPRMC,004640.000,A,3727.6217,N,12208.2861,W,6.38,359.46,061007,,,D*78 -$GPRMC,004645.000,A,3727.6322,N,12208.2880,W,10.02,331.10,061007,,,D*46 -$GPRMC,004650.000,A,3727.6394,N,12208.3010,W,6.76,277.11,061007,,,D*79 -$GPRMC,004655.000,A,3727.6382,N,12208.3058,W,1.58,256.67,061007,,,D*7E -$GPRMC,004700.000,A,3727.6253,N,12208.3024,W,6.34,164.31,061007,,,A*70 -$GPRMC,004715.000,A,3727.5854,N,12208.3345,W,5.00,267.98,061007,,,A*79 -$GPRMC,004720.000,A,3727.5993,N,12208.3323,W,6.50,26.91,061007,,,A*4D -$GPRMC,004725.000,A,3727.6123,N,12208.3159,W,13.14,44.68,061007,,,A*71 diff --git a/location/data/properties b/location/data/properties deleted file mode 100644 index b6878af..0000000 --- a/location/data/properties +++ /dev/null @@ -1,10 +0,0 @@ -requiresNetwork false -requiresSatellite false -requiresCell false -hasMonetaryCost false -supportsAltitude true -supportsBearing true -supportsSpeed true -repeat true -accuracy 1 -powerRequirement 1 diff --git a/location/data/test/class b/location/data/test/class deleted file mode 100644 index 495b172..0000000 --- a/location/data/test/class +++ /dev/null @@ -1 +0,0 @@ -android.test.TestLocationProvider diff --git a/location/data/track/properties b/location/data/track/properties deleted file mode 100644 index 1f1ed5e..0000000 --- a/location/data/track/properties +++ /dev/null @@ -1,10 +0,0 @@ -requiresNetwork true -requiresSatellite false -requiresCell false -hasMonetaryCost false -supportsAltitude true -supportsBearing false -supportsSpeed false -repeat true -accuracy 1 -powerRequirement 3 diff --git a/location/data/track/track b/location/data/track/track deleted file mode 100644 index a69ba2a..0000000 --- a/location/data/track/track +++ /dev/null @@ -1 +0,0 @@ -00 003405.000 3725.3433 12205.7921 101.2 65.3 diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java index ac8a344..dacfeb9 100644 --- a/location/java/android/location/LocationManager.java +++ b/location/java/android/location/LocationManager.java @@ -103,9 +103,6 @@ public class LocationManager { */ public static final String KEY_LOCATION_CHANGED = "location"; - /** @hide -- does this belong here? */ - public static final String PROVIDER_DIR = "/data/location"; - /** @hide */ public static final String SYSTEM_DIR = "/data/system/location"; diff --git a/location/java/com/android/internal/location/LocationProviderImpl.java b/location/java/com/android/internal/location/LocationProviderImpl.java index 7041849..5e9c074 100644 --- a/location/java/com/android/internal/location/LocationProviderImpl.java +++ b/location/java/com/android/internal/location/LocationProviderImpl.java @@ -21,13 +21,8 @@ import android.location.Location; import android.location.LocationProvider; import android.os.Bundle; import android.os.RemoteException; -import android.util.Config; import android.util.Log; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -75,49 +70,6 @@ public abstract class LocationProviderImpl extends LocationProvider { return sProvidersByName.get(name); } - public static LocationProviderImpl loadFromClass(File classFile) { - if (!classFile.exists()) { - return null; - } - if (Config.LOGD) { - Log.d(TAG, "Loading class specifier file " + classFile.getPath()); - } - String className = null; - try { - BufferedReader br = - new BufferedReader(new FileReader(classFile), 8192); - className = br.readLine(); - br.close(); - Class providerClass = Class.forName(className); - if (Config.LOGD) { - Log.d(TAG, "Loading provider class " + providerClass.getName()); - } - LocationProviderImpl provider = - (LocationProviderImpl) providerClass.newInstance(); - if (Config.LOGD) { - Log.d(TAG, "Got provider instance " + provider); - } - - return provider; - } catch (IOException ioe) { - Log.e(TAG, "IOException loading config file " + - classFile.getPath(), ioe); - } catch (IllegalAccessException iae) { - Log.e(TAG, "IllegalAccessException loading class " + - className, iae); - } catch (InstantiationException ie) { - Log.e(TAG, "InstantiationException loading class " + - className, ie); - } catch (ClassNotFoundException cnfe) { - Log.e(TAG, "ClassNotFoundException loading class " + - className, cnfe); - } catch (ClassCastException cce) { - Log.e(TAG, "ClassCastException loading class " + - className, cce); - } - return null; - } - public void reportLocationChanged(Location location) { try { mLocationManager.setLocation(location); diff --git a/location/java/com/android/internal/location/TrackProvider.java b/location/java/com/android/internal/location/TrackProvider.java deleted file mode 100644 index c6abe13..0000000 --- a/location/java/com/android/internal/location/TrackProvider.java +++ /dev/null @@ -1,731 +0,0 @@ -// Copyright 2007 The Android Open Source Project - -package com.android.internal.location; - -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; -import org.xmlpull.v1.XmlPullParserFactory; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.io.Reader; -import java.util.ArrayList; -import java.util.List; -import java.util.StringTokenizer; - -import android.location.Criteria; -import android.location.ILocationManager; -import android.location.Location; -import android.os.Bundle; -import android.util.Config; -import android.util.Log; - -/** - * A dummy provider that returns positions interpolated from a sequence - * of caller-supplied waypoints. The waypoints are supplied as a - * String containing one or more numeric quadruples of the form: - * <br> - * <code> - * <time in millis> <latitude> <longitude> <altitude> - * </code> - * - * <p> The waypoints must be supplied in increasing timestamp order. - * - * <p> The time at which the provider is constructed is considered to - * be time 0, and further requests for positions will return a - * position that is linearly interpolated between the waypoints whose - * timestamps are closest to the amount of wall clock time that has - * elapsed since time 0. - * - * <p> Following the time of the last waypoint, the position of that - * waypoint will continue to be returned indefinitely. - * - * {@hide} - */ -public class TrackProvider extends LocationProviderImpl { - static final String LOG_TAG = "TrackProvider"; - - private static final long INTERVAL = 1000L; - - private boolean mEnabled = true; - private TrackProviderThread mThread; - - private double mLatitude; - private double mLongitude; - private boolean mHasAltitude; - private boolean mHasBearing; - private boolean mHasSpeed; - private double mAltitude; - private float mBearing; - private float mSpeed; - private Bundle mExtras; - - private long mBaseTime; - private long mLastTime = -1L; - private long mTime; - - private long mMinTime; - private long mMaxTime; - - private List<Waypoint> mWaypoints = new ArrayList<Waypoint>(); - private int mWaypointIndex = 0; - - private boolean mRequiresNetwork = false; - private boolean mRequiresSatellite = false; - private boolean mRequiresCell = false; - private boolean mHasMonetaryCost = false; - private boolean mSupportsAltitude = true; - private boolean mSupportsSpeed = true; - private boolean mSupportsBearing = true; - private boolean mRepeat = false; - private int mPowerRequirement = Criteria.POWER_LOW; - private int mAccuracy = Criteria.ACCURACY_COARSE; - - private float mTrackSpeed = 100.0f; // km/hr - default for kml tracks - - private Location mInitialLocation; - - private class TrackProviderThread extends Thread { - - private boolean mDone = false; - - public TrackProviderThread() { - super("TrackProviderThread"); - } - - public void run() { - // thread exits after disable() is called - synchronized (this) { - while (!mDone) { - try { - wait(INTERVAL); - } catch (InterruptedException e) { - } - - if (!mDone) { - TrackProvider.this.update(); - } - } - } - } - - synchronized void setDone() { - mDone = true; - notify(); - } - } - - private void close(Reader rdr) { - try { - if (rdr != null) { - rdr.close(); - } - } catch (IOException e) { - Log.w(LOG_TAG, "Exception closing reader", e); - } - } - - public void readTrack(File trackFile) { - BufferedReader br = null; - try { - br = new BufferedReader(new FileReader(trackFile), 8192); - String s; - - long lastTime = -Long.MAX_VALUE; - while ((s = br.readLine()) != null) { - String[] tokens = s.split("\\s+"); - if (tokens.length != 4 && tokens.length != 6) { - Log.e(LOG_TAG, "Got track \"" + s + - "\", wanted <time> <long> <lat> <alt> [<bearing> <speed>]"); - continue; - } - long time; - double longitude, latitude, altitude; - try { - time = Long.parseLong(tokens[0]); - longitude = Double.parseDouble(tokens[1]); - latitude = Double.parseDouble(tokens[2]); - altitude = Double.parseDouble(tokens[3]); - } catch (NumberFormatException e) { - Log.e(LOG_TAG, "Got track \"" + s + - "\", wanted <time> <long> <lat> <alt> " + - "[<bearing> <speed>]", e); - continue; - } - - Waypoint w = new Waypoint(getName(), time, latitude, longitude, altitude); - if (tokens.length >= 6) { - float bearing, speed; - try { - bearing = Float.parseFloat(tokens[4]); - speed = Float.parseFloat(tokens[5]); - w.setBearing(bearing); - w.setSpeed(speed); - } catch (NumberFormatException e) { - Log.e(LOG_TAG, "Ignoring bearing and speed \"" + - tokens[4] + "\", \"" + tokens[5] + "\"", e); - } - } - - if (mInitialLocation == null) { - mInitialLocation = w.getLocation(); - } - - // Ignore waypoints whose time is less than or equal to 0 or - // the time of the previous waypoint - if (time < 0) { - Log.e(LOG_TAG, "Ignoring waypoint at negative time=" + time); - continue; - } - if (time <= lastTime) { - Log.e(LOG_TAG, "Ignoring waypoint at time=" + time + - " (< " + lastTime + ")"); - continue; - } - - mWaypoints.add(w); - lastTime = time; - } - - setTimes(); - return; - } catch (IOException e) { - Log.e(LOG_TAG, "Exception reading track file", e); - mWaypoints.clear(); - } finally { - close(br); - } - } - - public void readKml(File kmlFile) { - FileReader kmlReader = null; - try { - kmlReader = new FileReader(kmlFile); - XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); - XmlPullParser xpp = factory.newPullParser(); - xpp.setInput(kmlReader); - - // Concatenate the text of each <coordinates> tag - boolean inCoordinates = false; - StringBuilder sb = new StringBuilder(); - int eventType = xpp.getEventType(); - do { - if (eventType == XmlPullParser.START_DOCUMENT) { - // do nothing - } else if (eventType == XmlPullParser.END_DOCUMENT) { - // do nothing - } else if (eventType == XmlPullParser.START_TAG) { - String startTagName = xpp.getName(); - if (startTagName.equals("coordinates")) { - inCoordinates = true; - } - } else if (eventType == XmlPullParser.END_TAG) { - String endTagName = xpp.getName(); - if (endTagName.equals("coordinates")) { - inCoordinates = false; - } - } else if (eventType == XmlPullParser.TEXT) { - if (inCoordinates) { - sb.append(xpp.getText()); - sb.append(' '); - } - } - eventType = xpp.next(); - } while (eventType != XmlPullParser.END_DOCUMENT); - - String coordinates = sb.toString(); - - // Parse the "lon,lat,alt" triples and supply times - // for each waypoint based on a constant speed - Location loc = null; - double KM_PER_HOUR = mTrackSpeed; - double KM_PER_METER = 1.0 / 1000.0; - double MILLIS_PER_HOUR = 60.0 * 60.0 * 1000.0; - double MILLIS_PER_METER = - (1.0 / KM_PER_HOUR) * (KM_PER_METER) * (MILLIS_PER_HOUR); - long time = 0L; - - StringTokenizer st = new StringTokenizer(coordinates, ", "); - while (st.hasMoreTokens()) { - try { - String lon = st.nextToken(); - String lat = st.nextToken(); - String alt = st.nextToken(); - if (Config.LOGD) { - Log.d(LOG_TAG, - "lon=" + lon + ", lat=" + lat + ", alt=" + alt); - } - - double nLongitude = Double.parseDouble(lon); - double nLatitude = Double.parseDouble(lat); - double nAltitude = Double.parseDouble(alt); - - Location nLoc = new Location(getName()); - nLoc.setLatitude(nLatitude); - nLoc.setLongitude(nLongitude); - if (loc != null) { - double distance = loc.distanceTo(nLoc); - if (Config.LOGD) { - Log.d(LOG_TAG, "distance = " + distance); - } - time += (long) (distance * MILLIS_PER_METER); - } - - Waypoint w = new Waypoint(getName(), time, - nLatitude, nLongitude, nAltitude); - if (supportsSpeed()) { - w.setSpeed(mTrackSpeed); - } - if (supportsBearing()) { - w.setBearing(0.0f); - } - mWaypoints.add(w); - - if (mInitialLocation == null) { - mInitialLocation = w.getLocation(); - } - - loc = nLoc; - } catch (NumberFormatException nfe) { - Log.e(LOG_TAG, "Got NumberFormatException reading KML data: " + - nfe, nfe); - } - } - - setTimes(); - return; - } catch (IOException ioe) { - mWaypoints.clear(); - Log.e(LOG_TAG, "Exception reading KML data: " + ioe, ioe); - // fall through - } catch (XmlPullParserException xppe) { - mWaypoints.clear(); - Log.e(LOG_TAG, "Exception reading KML data: " + xppe, xppe); - // fall through - } finally { - close(kmlReader); - } - } - - public void readNmea(String name, File file) { - BufferedReader br = null; - try { - br = new BufferedReader(new FileReader(file), 8192); - String s; - - String provider = getName(); - NmeaParser parser = new NmeaParser(name); - while ((s = br.readLine()) != null) { - boolean newWaypoint = parser.parseSentence(s); - if (newWaypoint) { - Location loc = parser.getLocation(); - Waypoint w = new Waypoint(loc); - mWaypoints.add(w); - // Log.i(TAG, "Got waypoint " + w); - } - } - - setTimes(); - return; - } catch (IOException ioe) { - Log.e(LOG_TAG, "Exception reading NMEA data: " + ioe); - mWaypoints.clear(); - } finally { - close(br); - } - } - - private static boolean booleanVal(String tf) { - return (tf == null) || (tf.equalsIgnoreCase("true")); - } - - private static int intVal(String val) { - try { - return (val == null) ? 0 : Integer.parseInt(val); - } catch (NumberFormatException nfe) { - return 0; - } - } - - private static float floatVal(String val) { - try { - return (val == null) ? 0 : Float.parseFloat(val); - } catch (NumberFormatException nfe) { - return 0.0f; - } - } - - public void readProperties(File propertiesFile) { - BufferedReader br = null; - if (!propertiesFile.exists()) { - return; - } - try { - if (Config.LOGD) { - Log.d(LOG_TAG, "Loading properties file " + - propertiesFile.getPath()); - } - br = new BufferedReader(new FileReader(propertiesFile), 8192); - - String s; - while ((s = br.readLine()) != null) { - StringTokenizer st = new StringTokenizer(s); - String command = null; - String value = null; - if (!st.hasMoreTokens()) { - continue; - } - command = st.nextToken(); - if (st.hasMoreTokens()) { - value = st.nextToken(); - } - - if (command.equalsIgnoreCase("requiresNetwork")) { - setRequiresNetwork(booleanVal(value)); - } else if (command.equalsIgnoreCase("requiresSatellite")) { - setRequiresSatellite(booleanVal(value)); - } else if (command.equalsIgnoreCase("requiresCell")) { - setRequiresCell(booleanVal(value)); - } else if (command.equalsIgnoreCase("hasMonetaryCost")) { - setHasMonetaryCost(booleanVal(value)); - } else if (command.equalsIgnoreCase("supportsAltitude")) { - setSupportsAltitude(booleanVal(value)); - } else if (command.equalsIgnoreCase("supportsBearing")) { - setSupportsBearing(booleanVal(value)); - } else if (command.equalsIgnoreCase("repeat")) { - setRepeat(booleanVal(value)); - } else if (command.equalsIgnoreCase("supportsSpeed")) { - setSupportsSpeed(booleanVal(value)); - } else if (command.equalsIgnoreCase("powerRequirement")) { - setPowerRequirement(intVal(value)); - } else if (command.equalsIgnoreCase("accuracy")) { - setAccuracy(intVal(value)); - } else if (command.equalsIgnoreCase("trackspeed")) { - setTrackSpeed(floatVal(value)); - } else { - Log.e(LOG_TAG, "Unknown command \"" + command + "\""); - } - } - } catch (IOException ioe) { - Log.e(LOG_TAG, "IOException reading properties file " + - propertiesFile.getPath(), ioe); - } finally { - try { - if (br != null) { - br.close(); - } - } catch (IOException e) { - Log.w(LOG_TAG, "IOException closing properties file " + - propertiesFile.getPath(), e); - } - } - } - - public TrackProvider(String name, ILocationManager locationManager) { - super(name, locationManager); - setTimes(); - } - - public TrackProvider(String name, ILocationManager locationManager, File file) { - this(name, locationManager); - - String filename = file.getName(); - if (filename.endsWith("kml")) { - readKml(file); - } else if (filename.endsWith("nmea")) { - readNmea(getName(), file); - } else if (filename.endsWith("track")) { - readTrack(file); - } else { - Log.e(LOG_TAG, "Can't initialize TrackProvider from file " + - filename + " (not *kml, *nmea, or *track)"); - } - setTimes(); - } - - private void setTimes() { - mBaseTime = System.currentTimeMillis(); - if (mWaypoints.size() >= 2) { - mMinTime = mWaypoints.get(0).getTime(); - mMaxTime = mWaypoints.get(mWaypoints.size() - 1).getTime(); - } else { - mMinTime = mMaxTime = 0; - } - } - - private double interp(double d0, double d1, float frac) { - return d0 + frac * (d1 - d0); - } - - private void update() { - long time = System.currentTimeMillis() - mBaseTime; - - List<Waypoint> waypoints = mWaypoints; - if (waypoints == null) { - return; - } - int size = waypoints.size(); - if (size < 2) { - return; - } - - long t = time; - if (t < mMinTime) { - t = mMinTime; - } - if (mRepeat) { - t -= mMinTime; - long deltaT = mMaxTime - mMinTime; - t %= 2 * deltaT; - if (t > deltaT) { - t = 2 * deltaT - t; - } - t += mMinTime; - } else if (t > mMaxTime) { - t = mMaxTime; - } - - // Locate the time interval for the current time - // We slide the window since we don't expect to move - // much between calls - - Waypoint w0 = waypoints.get(mWaypointIndex); - Waypoint w1 = waypoints.get(mWaypointIndex + 1); - - // If the right end of the current interval is too early, - // move forward to the next waypoint - while (t > w1.getTime()) { - w0 = w1; - w1 = waypoints.get(++mWaypointIndex + 1); - } - // If the left end of the current interval is too late, - // move back to the previous waypoint - while (t < w0.getTime()) { - w1 = w0; - w0 = waypoints.get(--mWaypointIndex); - } - - // Now we know that w0.mTime <= t <= w1.mTime - long w0Time = w0.getTime(); - long w1Time = w1.getTime(); - long dt = w1Time - w0Time; - - float frac = (dt == 0) ? 0 : ((float) (t - w0Time) / dt); - mLatitude = interp(w0.getLatitude(), w1.getLatitude(), frac); - mLongitude = interp(w0.getLongitude(), w1.getLongitude(), frac); - mHasAltitude = w0.hasAltitude() && w1.hasAltitude(); - if (mSupportsAltitude && mHasAltitude) { - mAltitude = interp(w0.getAltitude(), w1.getAltitude(), frac); - } - if (mSupportsBearing) { - mHasBearing = frac <= 0.5f ? w0.hasBearing() : w1.hasBearing(); - if (mHasBearing) { - mBearing = frac <= 0.5f ? w0.getBearing() : w1.getBearing(); - } - } - if (mSupportsSpeed) { - mHasSpeed = frac <= 0.5f ? w0.hasSpeed() : w1.hasSpeed(); - if (mHasSpeed) { - mSpeed = frac <= 0.5f ? w0.getSpeed() : w1.getSpeed(); - } - } - mLastTime = time; - mTime = time; - } - - public void setRequiresNetwork(boolean requiresNetwork) { - mRequiresNetwork = requiresNetwork; - } - - @Override public boolean requiresNetwork() { - return mRequiresNetwork; - } - - public void setRequiresSatellite(boolean requiresSatellite) { - mRequiresSatellite = requiresSatellite; - } - - @Override public boolean requiresSatellite() { - return mRequiresSatellite; - } - - public void setRequiresCell(boolean requiresCell) { - mRequiresCell = requiresCell; - } - - @Override public boolean requiresCell() { - return mRequiresCell; - } - - public void setHasMonetaryCost(boolean hasMonetaryCost) { - mHasMonetaryCost = hasMonetaryCost; - } - - @Override public boolean hasMonetaryCost() { - return mHasMonetaryCost; - } - - public void setSupportsAltitude(boolean supportsAltitude) { - mSupportsAltitude = supportsAltitude; - } - - @Override public boolean supportsAltitude() { - return mSupportsAltitude; - } - - public void setSupportsSpeed(boolean supportsSpeed) { - mSupportsSpeed = supportsSpeed; - } - - @Override public boolean supportsSpeed() { - return mSupportsSpeed; - } - - public void setSupportsBearing(boolean supportsBearing) { - mSupportsBearing = supportsBearing; - } - - @Override public boolean supportsBearing() { - return mSupportsBearing; - } - - public void setRepeat(boolean repeat) { - mRepeat = repeat; - } - - public void setPowerRequirement(int powerRequirement) { - if (powerRequirement < Criteria.POWER_LOW || - powerRequirement > Criteria.POWER_HIGH) { - throw new IllegalArgumentException("powerRequirement = " + - powerRequirement); - } - mPowerRequirement = powerRequirement; - } - - @Override public int getPowerRequirement() { - return mPowerRequirement; - } - - public void setAccuracy(int accuracy) { - mAccuracy = accuracy; - } - - @Override public int getAccuracy() { - return mAccuracy; - } - - public void setTrackSpeed(float trackSpeed) { - mTrackSpeed = trackSpeed; - } - - @Override public synchronized void enable() { - mEnabled = true; - mThread = new TrackProviderThread(); - mThread.start(); - } - - @Override public synchronized void disable() { - mEnabled = false; - if (mThread != null) { - mThread.setDone(); - try { - mThread.join(); - } catch (InterruptedException e) { - } - mThread = null; - } - } - - @Override public boolean isEnabled() { - return mEnabled; - } - - @Override public int getStatus(Bundle extras) { - return AVAILABLE; - } - - public Location getInitialLocation() { - return mInitialLocation; - } -} - -/** - * A simple tuple of (time stamp, latitude, longitude, altitude), plus optional - * extras. - * - * {@hide} - */ -class Waypoint { - public Location mLocation; - - public Waypoint(Location location) { - mLocation = location; - } - - public Waypoint(String providerName, long time, double latitude, double longitude, - double altitude) { - mLocation = new Location(providerName); - mLocation.setTime(time); - mLocation.setLatitude(latitude); - mLocation.setLongitude(longitude); - mLocation.setAltitude(altitude); - } - - public long getTime() { - return mLocation.getTime(); - } - - public double getLatitude() { - return mLocation.getLatitude(); - } - - public double getLongitude() { - return mLocation.getLongitude(); - } - - public boolean hasAltitude() { - return mLocation.hasAltitude(); - } - - public double getAltitude() { - return mLocation.getAltitude(); - } - - public boolean hasBearing() { - return mLocation.hasBearing(); - } - - public void setBearing(float bearing) { - mLocation.setBearing(bearing); - } - - public float getBearing() { - return mLocation.getBearing(); - } - - public boolean hasSpeed() { - return mLocation.hasSpeed(); - } - - public void setSpeed(float speed) { - mLocation.setSpeed(speed); - } - - public float getSpeed() { - return mLocation.getSpeed(); - } - - public Bundle getExtras() { - return mLocation.getExtras(); - } - - public Location getLocation() { - return new Location(mLocation); - } - - @Override public String toString() { - return "Waypoint[mLocation=" + mLocation + "]"; - } -} |