From 2149f64340919bdb5eb6bf18545008a27845faf5 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 3 Feb 2014 15:13:18 +0100 Subject: [PATCH] Added setting for height Refs #1179 --- CHANGELOG.md | 2 +- res/layout/settings.xml | 15 +++++++ res/values-ar/strings.xml | 1 + res/values-bg/strings.xml | 1 + res/values-ca/strings.xml | 1 + res/values-cs/strings.xml | 1 + res/values-da/strings.xml | 1 + res/values-de/strings.xml | 1 + res/values-ee/strings.xml | 1 + res/values-el/strings.xml | 1 + res/values-es/strings.xml | 1 + res/values-fa/strings.xml | 1 + res/values-fi/strings.xml | 1 + res/values-fr/strings.xml | 1 + res/values-ga/strings.xml | 1 + res/values-he/strings.xml | 1 + res/values-hi/strings.xml | 1 + res/values-hu/strings.xml | 1 + res/values-it/strings.xml | 1 + res/values-iw/strings.xml | 1 + res/values-ja/strings.xml | 1 + res/values-lt/strings.xml | 1 + res/values-nb-rNO/strings.xml | 1 + res/values-nl/strings.xml | 1 + res/values-nn-rNO/strings.xml | 1 + res/values-no-rNO/strings.xml | 1 + res/values-pl/strings.xml | 1 + res/values-pt/strings.xml | 1 + res/values-ro/strings.xml | 1 + res/values-ru/strings.xml | 1 + res/values-sk/strings.xml | 1 + res/values-sl/strings.xml | 1 + res/values-sr/strings.xml | 1 + res/values-sv/strings.xml | 1 + res/values-tl-rPH/strings.xml | 1 + res/values-tr/strings.xml | 1 + res/values-ua/strings.xml | 1 + res/values-vi/strings.xml | 1 + res/values-zh-rCN/strings.xml | 1 + res/values-zh-rTW/strings.xml | 1 + res/values/strings.xml | 1 + src/biz/bokhorst/xprivacy/PrivacyManager.java | 36 ++++++++------- src/biz/bokhorst/xprivacy/SettingsDialog.java | 45 ++++++++++++++++--- src/biz/bokhorst/xprivacy/UpdateService.java | 6 +-- tools/addstring.sh | 4 +- 45 files changed, 117 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c77c17e5..d0c792f23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ Test and beta releases will have experimental functions enabled by default. * Fixed on demand choice not sticking * Fixed on demand asking for same restriction * Fixed reboot problem in relation to on demand ([issue](https://github.com/M66B/XPrivacy/issues/1238)) -* Fake locations get a height of 686 meter +/- accuracy ([issue](https://github.com/M66B/XPrivacy/issues/1179)) +* Added setting for height ([issue](https://github.com/M66B/XPrivacy/issues/1179)) * Added restriction for *getGpsStatus* ([issue](https://github.com/M66B/XPrivacy/issues/1179)) * Removed restriction *Srv.getConfiguredNetworks* diff --git a/res/layout/settings.xml b/res/layout/settings.xml index 8d7f894c6..a6d1da570 100644 --- a/res/layout/settings.xml +++ b/res/layout/settings.xml @@ -224,6 +224,21 @@ android:singleLine="true" /> + + + + + + + + + diff --git a/res/values-ar/strings.xml b/res/values-ar/strings.xml index 5584f9ea8..2b20c6ba6 100644 --- a/res/values-ar/strings.xml +++ b/res/values-ar/strings.xml @@ -124,6 +124,7 @@ السيريال# خط العرض خط الطول + Altitude عنوان الماك عنوان الايبي رقم الهاتف diff --git a/res/values-bg/strings.xml b/res/values-bg/strings.xml index f0adda700..629a0a7f5 100644 --- a/res/values-bg/strings.xml +++ b/res/values-bg/strings.xml @@ -124,6 +124,7 @@ Serial# Геогр. ширина Геогр. дължина + Altitude MAC адрес IP address Телефонен номер diff --git a/res/values-ca/strings.xml b/res/values-ca/strings.xml index 6c16a0419..8c61024d7 100644 --- a/res/values-ca/strings.xml +++ b/res/values-ca/strings.xml @@ -122,6 +122,7 @@ Número de sèrie Latitud Longitud + Altitude Adreça MAC IP address Número de telèfon diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml index 5cf743fdc..82b641295 100644 --- a/res/values-cs/strings.xml +++ b/res/values-cs/strings.xml @@ -125,6 +125,7 @@ nicméně je nemožné zaručit bezchybnou funkčnost na všech zařízeních a Sériové číslo Zeměpisná šířka Zeměpisná délka + Altitude MAC adresa IP adresa Telefonní číslo diff --git a/res/values-da/strings.xml b/res/values-da/strings.xml index 7941ae800..c4dd1ee6d 100644 --- a/res/values-da/strings.xml +++ b/res/values-da/strings.xml @@ -122,6 +122,7 @@ Serienummer Breddegrad Længdegrad + Altitude MAC-adresse IP-adresse Telefonnummer diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 1de9abaf0..5b6005210 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -124,6 +124,7 @@ Seriennummer Breitengrad Längengrad + Altitude MAC-Adresse IP-Adresse Telefonnummer diff --git a/res/values-ee/strings.xml b/res/values-ee/strings.xml index b0ab19628..fb5b1f63e 100644 --- a/res/values-ee/strings.xml +++ b/res/values-ee/strings.xml @@ -124,6 +124,7 @@ kuid on võimatu garanteerida, et see töötab igal seadmel ja iga rakendusega. Seeria# Laiuskraad Pikkuskraad + Altitude MAC aadress IP aadress Telefoninumber diff --git a/res/values-el/strings.xml b/res/values-el/strings.xml index 7e92226f2..162d936ba 100644 --- a/res/values-el/strings.xml +++ b/res/values-el/strings.xml @@ -124,6 +124,7 @@ Σειριακός αριθμός Γεωγρ. πλάτος Γεωγρ. μήκος + Altitude Διεύθυνση MAC IP address Αριθμός τηλεφώνου diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index fadc4b10e..545ebba3d 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -124,6 +124,7 @@ sin embargo no puedo garantizar que funcione sin ningún fallo para cada disposi # de serie Latitud Longitud + Altitude Dirección MAC Dirección IP Número de Teléfono diff --git a/res/values-fa/strings.xml b/res/values-fa/strings.xml index 9a98dca6e..418659488 100644 --- a/res/values-fa/strings.xml +++ b/res/values-fa/strings.xml @@ -126,6 +126,7 @@ شماره سریال عرض جغرافیایی طول جغرافیایی + Altitude آدرس مک آدرس آی پی شماره تلفن diff --git a/res/values-fi/strings.xml b/res/values-fi/strings.xml index 3abf9d19e..c61f059db 100644 --- a/res/values-fi/strings.xml +++ b/res/values-fi/strings.xml @@ -123,6 +123,7 @@ sarjanumero# Latituudi Longituudi + Altitude MAC osoite IP osoite Puhelinnumero diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index 7fab7aa69..72bac6c32 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -124,6 +124,7 @@ il est impossible de garantir un fonctionnement parfait sur chaque appareil et p N° de série Latitude Longitude + Altitude Adresse MAC Adresse IP N° de téléphone diff --git a/res/values-ga/strings.xml b/res/values-ga/strings.xml index 2222f2fd2..559039946 100644 --- a/res/values-ga/strings.xml +++ b/res/values-ga/strings.xml @@ -124,6 +124,7 @@ Sraithuimhir# TX Domhanfhad + Altitude MAC seoladh seoladh IP uimhir Fón diff --git a/res/values-he/strings.xml b/res/values-he/strings.xml index 4b2d7d5e5..6e70126c3 100644 --- a/res/values-he/strings.xml +++ b/res/values-he/strings.xml @@ -124,6 +124,7 @@ however it is impossible to guarantee it will work flawless on each and every de Serial# קו אורך קו רוחב + Altitude כתובת MAC IP address מספר טלפון diff --git a/res/values-hi/strings.xml b/res/values-hi/strings.xml index 3c3f868b1..06d256739 100644 --- a/res/values-hi/strings.xml +++ b/res/values-hi/strings.xml @@ -124,6 +124,7 @@ क्रमांक# अक्षांश रेखांश + Altitude MAC address IP address फ़ोन संख्या diff --git a/res/values-hu/strings.xml b/res/values-hu/strings.xml index a9067681a..4b6a93b2a 100644 --- a/res/values-hu/strings.xml +++ b/res/values-hu/strings.xml @@ -124,6 +124,7 @@ de lehetetlen garantálni hogy tökéletesen működjön az összes eszközön Sorozatszám# Szélesség Hosszúság + Altitude MAC-cím IP cím Telefonszám diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml index 611ff699c..fc9bad6a3 100644 --- a/res/values-it/strings.xml +++ b/res/values-it/strings.xml @@ -124,6 +124,7 @@ ma è impossibile garantire che funzionerà in modo impeccabile su ogni disposit Numero di serie# Latitudine Longitudine + Altitude Indirizzo MAC Indirizzo IP Numero di Telefono diff --git a/res/values-iw/strings.xml b/res/values-iw/strings.xml index 4b2d7d5e5..6e70126c3 100644 --- a/res/values-iw/strings.xml +++ b/res/values-iw/strings.xml @@ -124,6 +124,7 @@ however it is impossible to guarantee it will work flawless on each and every de Serial# קו אורך קו רוחב + Altitude כתובת MAC IP address מספר טלפון diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml index fea03684f..0a390d9ea 100644 --- a/res/values-ja/strings.xml +++ b/res/values-ja/strings.xml @@ -124,6 +124,7 @@ シリアル番号 緯度 経度 + Altitude MAC アドレス IP アドレス 電話番号 diff --git a/res/values-lt/strings.xml b/res/values-lt/strings.xml index 5acda321c..7e6df4a92 100644 --- a/res/values-lt/strings.xml +++ b/res/values-lt/strings.xml @@ -125,6 +125,7 @@ Tačiau neįmanoma garantuoti, kad dirbs nepriekaištingai su kiekvienu prietais Serial# Platuma Ilguma + Altitude MAC adresas IP addresas Telefono nr. diff --git a/res/values-nb-rNO/strings.xml b/res/values-nb-rNO/strings.xml index 21ce25d3e..56cecf5a9 100644 --- a/res/values-nb-rNO/strings.xml +++ b/res/values-nb-rNO/strings.xml @@ -122,6 +122,7 @@ Serienummer Breddegrad Lengdegrad + Altitude MAC adresse IP adresse Telefonnummer diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml index 7ad42c738..0d7cfc51e 100644 --- a/res/values-nl/strings.xml +++ b/res/values-nl/strings.xml @@ -124,6 +124,7 @@ maar het is onmogelijk om te garanderen dat het op elk apparaat en voor elke app Serienummer Breedtegraad Lengtegraad + Hoogte MAC adres IP adres Telefoonnummer diff --git a/res/values-nn-rNO/strings.xml b/res/values-nn-rNO/strings.xml index 21ce25d3e..56cecf5a9 100644 --- a/res/values-nn-rNO/strings.xml +++ b/res/values-nn-rNO/strings.xml @@ -122,6 +122,7 @@ Serienummer Breddegrad Lengdegrad + Altitude MAC adresse IP adresse Telefonnummer diff --git a/res/values-no-rNO/strings.xml b/res/values-no-rNO/strings.xml index 21ce25d3e..56cecf5a9 100644 --- a/res/values-no-rNO/strings.xml +++ b/res/values-no-rNO/strings.xml @@ -122,6 +122,7 @@ Serienummer Breddegrad Lengdegrad + Altitude MAC adresse IP adresse Telefonnummer diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml index 968b8c078..b71ad96ed 100644 --- a/res/values-pl/strings.xml +++ b/res/values-pl/strings.xml @@ -125,6 +125,7 @@ Numer seryjny Szerokość geograficzna Długość geograficzna + Altitude Adres MAC Adres IP Numer telefonu diff --git a/res/values-pt/strings.xml b/res/values-pt/strings.xml index 17b1ecfbe..ff2101303 100644 --- a/res/values-pt/strings.xml +++ b/res/values-pt/strings.xml @@ -124,6 +124,7 @@ porém é impossível garantir que irá funcionar sem problemas em todos os disp Serial# Latitude Longitude + Altitude Endereço MAC Endereço IP Número de telefone diff --git a/res/values-ro/strings.xml b/res/values-ro/strings.xml index 43ba05516..17f14b6be 100644 --- a/res/values-ro/strings.xml +++ b/res/values-ro/strings.xml @@ -124,6 +124,7 @@ however it is impossible to guarantee it will work flawless on each and every de Serial# Latitudine Longitudine + Altitude MAC address IP address Phone number diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index 739801bff..48946123e 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -125,6 +125,7 @@ Серийный номер Широта Долгота + Altitude MAC-адрес IP адрес Номер телефона diff --git a/res/values-sk/strings.xml b/res/values-sk/strings.xml index 5ca932710..4088741fc 100644 --- a/res/values-sk/strings.xml +++ b/res/values-sk/strings.xml @@ -125,6 +125,7 @@ avšak nie je nemožné zaručiť, že bude fungovať bezchybne na každom zaria Sériové číslo Zemepisná šírka Zemepisná dĺžka + Altitude Adresa MAC Adresa IP Telefónne číslo diff --git a/res/values-sl/strings.xml b/res/values-sl/strings.xml index c87db644a..505743f8b 100644 --- a/res/values-sl/strings.xml +++ b/res/values-sl/strings.xml @@ -126,6 +126,7 @@ Serijska št. Geografska širina Geografska dolžina + Altitude MAC naslov IP naslov Telefonska številka diff --git a/res/values-sr/strings.xml b/res/values-sr/strings.xml index 897f799ca..70ecaa4bf 100644 --- a/res/values-sr/strings.xml +++ b/res/values-sr/strings.xml @@ -124,6 +124,7 @@ however it is impossible to guarantee it will work flawless on each and every de Serial# Ширина Дужина + Altitude МЕК адреса IP address Број телефона diff --git a/res/values-sv/strings.xml b/res/values-sv/strings.xml index edac0c692..ca2065c48 100644 --- a/res/values-sv/strings.xml +++ b/res/values-sv/strings.xml @@ -124,6 +124,7 @@ Det är emellertid omöjligt att garantera att appen fungerar på alla enheter o Serial# Latitud Longitud + Altitude MAC-adress IP-adress Telefonnummer diff --git a/res/values-tl-rPH/strings.xml b/res/values-tl-rPH/strings.xml index 82922537d..4ef245b70 100644 --- a/res/values-tl-rPH/strings.xml +++ b/res/values-tl-rPH/strings.xml @@ -124,6 +124,7 @@ Ang iyong Seryal# Latitud Longhitud + Altitude MAC address IP address Numero ng iyong telepono diff --git a/res/values-tr/strings.xml b/res/values-tr/strings.xml index cbe5536c2..1eb6c0eaa 100644 --- a/res/values-tr/strings.xml +++ b/res/values-tr/strings.xml @@ -123,6 +123,7 @@ Seri no Enlem Boylam + Altitude MAC adresi IP adresi Telefon numarası diff --git a/res/values-ua/strings.xml b/res/values-ua/strings.xml index 640a1f54d..e24869f8e 100644 --- a/res/values-ua/strings.xml +++ b/res/values-ua/strings.xml @@ -125,6 +125,7 @@ Серійний номер Широта Довгота + Altitude MAC-адреса IP адреса Номер телефону diff --git a/res/values-vi/strings.xml b/res/values-vi/strings.xml index 2ff54962d..befc0baf1 100644 --- a/res/values-vi/strings.xml +++ b/res/values-vi/strings.xml @@ -123,6 +123,7 @@ Serial# Vĩ độ Kinh độ + Altitude Địa chỉ MAC Địa chỉ IP Số điện thoại diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index 9d41be5ed..10b6bab16 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -124,6 +124,7 @@ 序列号 纬度 经度 + Altitude MAC 地址 IP 地址 电话号码 diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml index fe7eafa83..9a2676825 100644 --- a/res/values-zh-rTW/strings.xml +++ b/res/values-zh-rTW/strings.xml @@ -124,6 +124,7 @@ 序號 緯度 經度 + Altitude MAC 位置 IP 位置 手機號碼 diff --git a/res/values/strings.xml b/res/values/strings.xml index c08d9a5d9..e09e3423d 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -132,6 +132,7 @@ however it is impossible to guarantee it will work flawlessly on each and every Serial# Latitude Longitude + Altitude MAC address IP address IMEI diff --git a/src/biz/bokhorst/xprivacy/PrivacyManager.java b/src/biz/bokhorst/xprivacy/PrivacyManager.java index 3ece16fcc..1fb0a1dd4 100644 --- a/src/biz/bokhorst/xprivacy/PrivacyManager.java +++ b/src/biz/bokhorst/xprivacy/PrivacyManager.java @@ -66,6 +66,7 @@ public class PrivacyManager { public final static String cSettingSerial = "Serial"; public final static String cSettingLatitude = "Latitude"; public final static String cSettingLongitude = "Longitude"; + public final static String cSettingAltitude = "Altitude"; public final static String cSettingMac = "Mac"; public final static String cSettingIP = "IP"; public final static String cSettingImei = "IMEI"; @@ -733,29 +734,29 @@ public static Object getDefacedProp(int uid, String name) { } public static Location getDefacedLocation(int uid, Location location) { - String sLat = getSetting(null, uid, cSettingLatitude, null, true); - String sLon = getSetting(null, uid, cSettingLongitude, null, true); + // Christmas Island ~ -10.5 / 105.667 + String sLat = getSetting(null, uid, cSettingLatitude, "-10.5", true); + String sLon = getSetting(null, uid, cSettingLongitude, "105.667", true); + String sAlt = getSetting(null, uid, cSettingAltitude, "686", true); + + // Backward compatibility + if ("".equals(sLat)) + sLat = "-10.5"; + if ("".equals(sLon)) + sLon = "105.667"; if (cValueRandom.equals(sLat)) sLat = getRandomProp("LAT"); if (cValueRandom.equals(sLon)) sLon = getRandomProp("LON"); + if (cValueRandom.equals(sAlt)) + sAlt = getRandomProp("ALT"); // 1 degree ~ 111111 m // 1 m ~ 0,000009 degrees - // Christmas Island ~ -10.5 / 105.667 - - if (sLat == null || "".equals(sLat)) - location.setLatitude(-10.5); - else - location.setLatitude(Float.parseFloat(sLat) + (Math.random() * 2.0 - 1.0) * location.getAccuracy() * 9e-6); - - if (sLon == null || "".equals(sLon)) - location.setLongitude(105.667); - else - location.setLongitude(Float.parseFloat(sLon) + (Math.random() * 2.0 - 1.0) * location.getAccuracy() * 9e-6); - - location.setAltitude(686 + (Math.random() * 2.0 - 1.0) * location.getAccuracy()); + location.setLatitude(Float.parseFloat(sLat) + (Math.random() * 2.0 - 1.0) * location.getAccuracy() * 9e-6); + location.setLongitude(Float.parseFloat(sLon) + (Math.random() * 2.0 - 1.0) * location.getAccuracy() * 9e-6); + location.setAltitude(Float.parseFloat(sAlt) + (Math.random() * 2.0 - 1.0) * location.getAccuracy()); return location; } @@ -833,6 +834,11 @@ public static String getRandomProp(String name) { return Double.toString(d); } + if (name.equals("ALT")) { + double d = r.nextDouble() * 2 * 686; + return Double.toString(d); + } + if (name.equals("SubscriberId")) { String subscriber = "00101"; while (subscriber.length() < 15) diff --git a/src/biz/bokhorst/xprivacy/SettingsDialog.java b/src/biz/bokhorst/xprivacy/SettingsDialog.java index dabcd0b15..e5a96afb4 100644 --- a/src/biz/bokhorst/xprivacy/SettingsDialog.java +++ b/src/biz/bokhorst/xprivacy/SettingsDialog.java @@ -17,6 +17,7 @@ import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; +import android.widget.Toast; public class SettingsDialog { @@ -56,6 +57,7 @@ public static void edit(final Context context, ApplicationInfoEx appInfo) { final EditText etSerial = (EditText) dlgSettings.findViewById(R.id.etSerial); final EditText etLat = (EditText) dlgSettings.findViewById(R.id.etLat); final EditText etLon = (EditText) dlgSettings.findViewById(R.id.etLon); + final EditText etAlt = (EditText) dlgSettings.findViewById(R.id.etAlt); final EditText etSearch = (EditText) dlgSettings.findViewById(R.id.etSearch); final Button btnSearch = (Button) dlgSettings.findViewById(R.id.btnSearch); final EditText etMac = (EditText) dlgSettings.findViewById(R.id.etMac); @@ -77,6 +79,7 @@ public static void edit(final Context context, ApplicationInfoEx appInfo) { final CheckBox cbSerial = (CheckBox) dlgSettings.findViewById(R.id.cbSerial); final CheckBox cbLat = (CheckBox) dlgSettings.findViewById(R.id.cbLat); final CheckBox cbLon = (CheckBox) dlgSettings.findViewById(R.id.cbLon); + final CheckBox cbAlt = (CheckBox) dlgSettings.findViewById(R.id.cbAlt); final CheckBox cbMac = (CheckBox) dlgSettings.findViewById(R.id.cbMac); final CheckBox cbImei = (CheckBox) dlgSettings.findViewById(R.id.cbImei); final CheckBox cbPhone = (CheckBox) dlgSettings.findViewById(R.id.cbPhone); @@ -90,10 +93,10 @@ public static void edit(final Context context, ApplicationInfoEx appInfo) { Button btnOk = (Button) dlgSettings.findViewById(R.id.btnOk); Button btnCancel = (Button) dlgSettings.findViewById(R.id.btnCancel); - final EditText[] edits = new EditText[] { etSerial, etLat, etLon, etMac, etIP, etImei, etPhone, etId, etGsfId, - etAdId, etMcc, etMnc, etCountry, etOperator, etIccId, etSubscriber, etSSID, etUa }; + final EditText[] edits = new EditText[] { etSerial, etLat, etLon, etAlt, etMac, etIP, etImei, etPhone, etId, + etGsfId, etAdId, etMcc, etMnc, etCountry, etOperator, etIccId, etSubscriber, etSSID, etUa }; - final CheckBox[] boxes = new CheckBox[] { cbSerial, cbLat, cbLon, cbMac, cbImei, cbPhone, cbId, cbGsfId, + final CheckBox[] boxes = new CheckBox[] { cbSerial, cbLat, cbLon, cbAlt, cbMac, cbImei, cbPhone, cbId, cbGsfId, cbAdId, cbCountry, cbSubscriber, cbSSID }; // Listen for changes @@ -136,6 +139,13 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { } }); + cbAlt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + etAlt.setEnabled(!isChecked); + } + }); + cbMac.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { @@ -228,6 +238,7 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { String serial = PrivacyManager.getSetting(null, -uid, PrivacyManager.cSettingSerial, "", false); String lat = PrivacyManager.getSetting(null, -uid, PrivacyManager.cSettingLatitude, "", false); String lon = PrivacyManager.getSetting(null, -uid, PrivacyManager.cSettingLongitude, "", false); + String alt = PrivacyManager.getSetting(null, -uid, PrivacyManager.cSettingAltitude, "", false); String mac = PrivacyManager.getSetting(null, -uid, PrivacyManager.cSettingMac, "", false); String imei = PrivacyManager.getSetting(null, -uid, PrivacyManager.cSettingImei, "", false); String phone = PrivacyManager.getSetting(null, -uid, PrivacyManager.cSettingPhone, "", false); @@ -288,6 +299,7 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { cbSerial.setChecked(serial.equals(PrivacyManager.cValueRandom)); cbLat.setChecked(lat.equals(PrivacyManager.cValueRandom)); cbLon.setChecked(lon.equals(PrivacyManager.cValueRandom)); + cbAlt.setChecked(alt.equals(PrivacyManager.cValueRandom)); cbMac.setChecked(mac.equals(PrivacyManager.cValueRandom)); cbImei.setChecked(imei.equals(PrivacyManager.cValueRandom)); cbPhone.setChecked(phone.equals(PrivacyManager.cValueRandom)); @@ -302,6 +314,7 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { etSerial.setText(cbSerial.isChecked() ? "" : serial); etLat.setText(cbLat.isChecked() ? "" : lat); etLon.setText(cbLon.isChecked() ? "" : lon); + etAlt.setText(cbAlt.isChecked() ? "" : alt); etMac.setText(cbMac.isChecked() ? "" : mac); etImei.setText(cbImei.isChecked() ? "" : imei); etPhone.setText(cbPhone.isChecked() ? "" : phone); @@ -315,6 +328,7 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { etSerial.setEnabled(!cbSerial.isChecked()); etLat.setEnabled(!cbLat.isChecked()); etLon.setEnabled(!cbLon.isChecked()); + etAlt.setEnabled(!cbAlt.isChecked()); etSearch.setEnabled(Geocoder.isPresent()); btnSearch.setEnabled(Geocoder.isPresent()); @@ -341,18 +355,20 @@ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { @Override public void onClick(View view) { try { - etLat.setText(""); - etLon.setText(""); String search = etSearch.getText().toString(); final List
listAddress = new Geocoder(context).getFromLocationName(search, 1); if (listAddress.size() > 0) { Address address = listAddress.get(0); // Get coordinates - if (address.hasLatitude()) + if (address.hasLatitude()) { + cbLat.setChecked(false); etLat.setText(Double.toString(address.getLatitude())); - if (address.hasLongitude()) + } + if (address.hasLongitude()) { + cbLon.setChecked(false); etLon.setText(Double.toString(address.getLongitude())); + } // Get address StringBuilder sb = new StringBuilder(); @@ -364,6 +380,7 @@ public void onClick(View view) { etSearch.setText(sb.toString()); } } catch (Throwable ex) { + Toast.makeText(context, ex.getMessage(), Toast.LENGTH_LONG).show(); Util.bug(null, ex); } } @@ -389,6 +406,7 @@ public void onClick(View view) { etSerial.setText(PrivacyManager.getRandomProp("SERIAL")); etLat.setText(PrivacyManager.getRandomProp("LAT")); etLon.setText(PrivacyManager.getRandomProp("LON")); + etAlt.setText(PrivacyManager.getRandomProp("ALT")); etMac.setText(PrivacyManager.getRandomProp("MAC")); etImei.setText(PrivacyManager.getRandomProp("IMEI")); etPhone.setText(PrivacyManager.getRandomProp("PHONE")); @@ -465,6 +483,19 @@ public void onClick(View view) { PrivacyManager.setSetting(null, uid, PrivacyManager.cSettingLongitude, null); } + // Set altitude + if (cbAlt.isChecked()) + PrivacyManager.setSetting(null, uid, PrivacyManager.cSettingAltitude, PrivacyManager.cValueRandom); + else + try { + float alt = Float.parseFloat(etAlt.getText().toString().replace(',', '.')); + if (alt < -10000 || alt > 10000) + throw new InvalidParameterException(); + PrivacyManager.setSetting(null, uid, PrivacyManager.cSettingAltitude, Float.toString(alt)); + } catch (Throwable ignored) { + PrivacyManager.setSetting(null, uid, PrivacyManager.cSettingAltitude, null); + } + // Other settings PrivacyManager.setSetting(null, uid, PrivacyManager.cSettingMac, getValue(cbMac, etMac)); PrivacyManager.setSetting(null, uid, PrivacyManager.cSettingIP, getValue(null, etIP)); diff --git a/src/biz/bokhorst/xprivacy/UpdateService.java b/src/biz/bokhorst/xprivacy/UpdateService.java index 4199e058b..f361abf2a 100644 --- a/src/biz/bokhorst/xprivacy/UpdateService.java +++ b/src/biz/bokhorst/xprivacy/UpdateService.java @@ -29,11 +29,6 @@ public IBinder onBind(Intent intent) { return null; } - @Override - public void onTrimMemory(int level) { - Util.log(null, Log.WARN, "Service received trim memory level=" + level); - } - @Override public int onStartCommand(Intent intent, int flags, int startId) { // Check if work @@ -202,6 +197,7 @@ private static List getRandomizeWork(Context context, int uid) { if (PrivacyManager.getSettingBool(null, -uid, PrivacyManager.cSettingRandom, false, true)) { listWork.add(new PSetting(uid, PrivacyManager.cSettingLatitude, PrivacyManager.getRandomProp("LAT"))); listWork.add(new PSetting(uid, PrivacyManager.cSettingLongitude, PrivacyManager.getRandomProp("LON"))); + listWork.add(new PSetting(uid, PrivacyManager.cSettingAltitude, PrivacyManager.getRandomProp("ALT"))); listWork.add(new PSetting(uid, PrivacyManager.cSettingSerial, PrivacyManager.getRandomProp("SERIAL"))); listWork.add(new PSetting(uid, PrivacyManager.cSettingMac, PrivacyManager.getRandomProp("MAC"))); listWork.add(new PSetting(uid, PrivacyManager.cSettingPhone, PrivacyManager.getRandomProp("PHONE"))); diff --git a/tools/addstring.sh b/tools/addstring.sh index 988bf36ec..cc7d92dd2 100755 --- a/tools/addstring.sh +++ b/tools/addstring.sh @@ -1,6 +1,6 @@ #!/bin/bash -grep -RIl "\Act on the entire category' +grep -RIl "\Altitude' #grep -RIl "\