Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added wake-up mechanism; Added logging to file #37

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
/res/raw/build.txt
/.settings
/local.properties
/.nb-gradle/
/.nb-gradle/
/private/
9 changes: 6 additions & 3 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
android:versionName="0.2.8">

<uses-sdk
android:minSdkVersion="16"
android:minSdkVersion="17"
android:targetSdkVersion="26" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand All @@ -22,18 +23,20 @@
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">

<activity
android:name="org.openbmap.unifiedNlp.SettingsActivity"
android:exported="true"
android:label="@string/preferences"/>

<service
android:name="org.openbmap.unifiedNlp.services.RadiocellsOrgNlpService"
android:exported="true"
android:label="Radiocells.org Unified Network Location Provider Backend"
android:permission="android.permission.ACCESS_COARSE_LOCATION">
<intent-filter>
<action android:name="org.microg.nlp.LOCATION_BACKEND" />
<action android:name="org.openbmap.unifiedNlp.LOCATION_UPDATE_CELLS_ONLY" />
</intent-filter>

<meta-data
Expand All @@ -42,4 +45,4 @@
</service>
</application>

</manifest>
</manifest>
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,19 @@ apply plugin: 'com.android.application'

repositories {
mavenCentral()
jcenter()
}

dependencies {
compile group: 'org.microg', name: 'unifiednlp-api', version: '1.5.4'
compile 'ch.acra:acra:4.5.0'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.obsez.android.lib.filechooser:filechooser:1.1.5'
}

android {
compileSdkVersion 21
buildToolsVersion '25.0.3'
buildToolsVersion "25.0.3"
lintOptions.abortOnError false

sourceSets {
Expand All @@ -64,4 +66,4 @@ task writeVersionInfo {

if (file('user.gradle').exists()) {
apply from: 'user.gradle'
}
}
2 changes: 1 addition & 1 deletion res/layout/dialogpreference_catalogs_group.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
android:layout_width="wrap_content"
android:layout_height="?android:attr/listPreferredItemHeight"
android:layout_marginLeft="8dp"
android:gravity="start"
android:gravity="end"
android:paddingLeft="32dp"
android:paddingTop="8dp"
android:textSize="14sp"
Expand Down
19 changes: 19 additions & 0 deletions res/values-ja/log_file_lasting.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="log_file_lasting_entries">
<item>@string/log_file_12_label</item>
<item>@string/log_file_24_label</item>
<item>@string/log_file_48_label</item>
<item>@string/log_file_72_label</item>
<item>@string/log_file_168_label</item>
<item>@string/log_file_720_label</item>
</string-array>
<string-array name="log_file_lasting_values">
<item>12</item>
<item>24</item>
<item>48</item>
<item>72</item>
<item>168</item>
<item>720</item>
</string-array>
</resources>
11 changes: 11 additions & 0 deletions res/values-ja/operation_modes.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="operation_mode_entries">
<item>Online mode</item>
<item>Offline mode</item>
</string-array>
<string-array name="operation_mode_values">
<item>online</item>
<item>offline</item>
</string-array>
</resources>
13 changes: 13 additions & 0 deletions res/values-ja/sources.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="source_entries">
<item>Combined (Wifis and Cells)</item>
<item>Wifis only</item>
<item>Cells only</item>
</string-array>
<string-array name="source_values">
<item>combined</item>
<item>wifis</item>
<item>cells</item>
</string-array>
</resources>
13 changes: 13 additions & 0 deletions res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,17 @@
<string name="prefs_download_wifi_catalog">WiFi カタログをダウンロード</string>
<string name="prefs_download_wifi_catalog_summary">現在のサイズ (国に応じて 10–400MB)</string>
<string name="server_parsing_error">サーバーの応答を解析中にエラー</string>
<string name="wake_up_strategy_summary">When location stucks when phone sleeps you can try to wake up phone when cell is looked for</string>
<string name="wake_up_strategy_title">Wake up strategy</string>
<string name="nowakeup_label">No wake up</string>
<string name="wakeuppartial_label">Wake up CPU only</string>
<string name="wakeupfull_label">Wake up with display</string>
<string name="log_file_lasting_summary">After specified number of time log file will recreated</string>
<string name="log_file_lasting_title">Rotation of the log file</string>
<string name="log_file_12_label">12 hours</string>
<string name="log_file_24_label">a day</string>
<string name="log_file_48_label">two days</string>
<string name="log_file_72_label">three days</string>
<string name="log_file_168_label">a week</string>
<string name="log_file_720_label">a month</string>
</resources>
13 changes: 13 additions & 0 deletions res/values-ja/wake_up_strategy.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="wake_up_strategy_entries">
<item>@string/nowakeup_label</item>
<item>@string/wakeuppartial_label</item>
<item>@string/wakeupfull_label</item>
</string-array>
<string-array name="wake_up_strategy_values">
<item>nowakeup</item>
<item>wakeuppartial</item>
<item>wakeupfull</item>
</string-array>
</resources>
19 changes: 19 additions & 0 deletions res/values/log_file_lasting.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="log_file_lasting_entries">
<item>@string/log_file_12_label</item>
<item>@string/log_file_24_label</item>
<item>@string/log_file_48_label</item>
<item>@string/log_file_72_label</item>
<item>@string/log_file_168_label</item>
<item>@string/log_file_720_label</item>
</string-array>
<string-array name="log_file_lasting_values">
<item>12</item>
<item>24</item>
<item>48</item>
<item>72</item>
<item>168</item>
<item>720</item>
</string-array>
</resources>
14 changes: 14 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,18 @@
<string name="prefs_download_wifi_catalog">Download Wifi Catalog</string>
<string name="prefs_download_wifi_catalog_summary">Current size (10–400MB depending on country)</string>
<string name="server_parsing_error">Error parsing server reply</string>
<string name="wake_up_strategy_summary">When location stucks when phone sleeps you can try to wake up phone when cell is looked for</string>
<string name="wake_up_strategy_title">Wake up strategy</string>
<string name="nowakeup_label">No wake up</string>
<string name="wakeuppartial_label">Wake up CPU only</string>
<string name="wakeupfull_label">Wake up with display</string>
<string name="debug_choose_file">Select directory for logging</string>
<string name="log_file_lasting_summary">After specified number of time log file will recreated</string>
<string name="log_file_lasting_title">Rotation of the log file</string>
<string name="log_file_12_label">12 hours</string>
<string name="log_file_24_label">a day</string>
<string name="log_file_48_label">two days</string>
<string name="log_file_72_label">three days</string>
<string name="log_file_168_label">a week</string>
<string name="log_file_720_label">a month</string>
</resources>
13 changes: 13 additions & 0 deletions res/values/wake_up_strategy.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="wake_up_strategy_entries">
<item>@string/nowakeup_label</item>
<item>@string/wakeuppartial_label</item>
<item>@string/wakeupfull_label</item>
</string-array>
<string-array name="wake_up_strategy_values">
<item>nowakeup</item>
<item>wakeuppartial</item>
<item>wakeupfull</item>
</string-array>
</resources>
22 changes: 22 additions & 0 deletions res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
android:key="mode"
android:summary="@string/operation_mode_summary"
android:title="@string/operation_mode_title"/>
<ListPreference
android:defaultValue="nowakeup"
android:entries="@array/wake_up_strategy_entries"
android:entryValues="@array/wake_up_strategy_values"
android:key="wake.up.strategy"
android:summary="@string/wake_up_strategy_summary"
android:title="@string/wake_up_strategy_title"/>
</PreferenceCategory>
<ListPreference
android:defaultValue="combined"
Expand Down Expand Up @@ -49,6 +56,21 @@
android:summaryOff="@string/off"
android:summaryOn="@string/on"
android:title="@string/debug_title" />
<CheckBoxPreference
android:defaultValue="false"
android:key="debug.to.file"
android:summaryOff="Don't log to file"
android:summaryOn="Log to file"
android:title="Log to file" />
<ListPreference
android:defaultValue="24"
android:entries="@array/log_file_lasting_entries"
android:entryValues="@array/log_file_lasting_values"
android:key="debug.file.lasting.hours"
android:summary="@string/log_file_lasting_summary"
android:title="@string/log_file_lasting_title"/>
<Preference android:title="@string/debug_choose_file"
android:key="debug.log.file" />
</PreferenceCategory>
<Preference
android:key="version"
Expand Down
5 changes: 5 additions & 0 deletions src/org/openbmap/unifiedNlp/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public final class Preferences {
*/
public static final String KEY_OPERATION_MODE = "mode";

public static final String KEY_WAKE_UP_STRATEGY = "wake.up.strategy";

public static final String KEY_SOURCE = "source";

/**
Expand All @@ -41,6 +43,9 @@ public final class Preferences {
* Broadcast debug messages?
*/
public static final String KEY_DEBUG_MESSAGES = "debug.messages";
public static final String KEY_DEBUG_FILE = "debug.log.file";
public static final String KEY_DEBUG_TO_FILE = "debug.to.file";
public static final String KEY_DEBUG_FILE_LASTING_HOURS = "debug.file.lasting.hours";

/*
* Default values following ..
Expand Down
Loading