FPII-2650: Update hiccup code to Hiccup 1.0.2
Codebase matches now commit 6de2b6915e1c707cf4a14dae76f2af2399015c50
This is a combination of 6 commits.
HIC-38 FIX: Bootup receiver is not called
Remove secret code.
Change-Id: I76f37698e8153e28a63497263e5e794429ba906a
# This is the 2nd commit message:
HIC-37: Properly parse the board date
Change-Id: Ib70f15dfcc2a348237464a57b7a7de5432ae711c
# This is the 3rd commit message:
HIC-39: Bumb version number to 1.0.1
Change-Id: I3a02d58f20a3837cf9cf9a5a56edb06ded87edd3
# This is the 4th commit message:
HIC-40: Change user visible version to 1.0.1 (drop Hiccup)
Change-Id: I49dd890f044d57348e6ea080e9fbf2a6ac228d1b
# This is the 5th commit message:
HIC-46: Fix typo in german setup wizard
Translated using Weblate (_DE (generated))
Currently translated at 100.0% (24 of 24 strings)
Change-Id: I906c5adbadacdb6d726b196f337c3427681919d8
# This is the 6th commit message:
HIC-52: Increase version number to 1.0.2
Change-Id: Ie79d5f1ed7f45f46ecc6f3d381501a13c6f6e7fc
Change-Id: If3bc71bc22518dffcdf1cdc28983bf613ddfb2d1
diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml
index 889c88a..d6c2d4a 100644
--- a/src/main/AndroidManifest.xml
+++ b/src/main/AndroidManifest.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.fairphone.hiccup.app"
- android:versionCode="010000"
- android:versionName="Hiccup 1.0.0">
+ android:versionCode="010002"
+ android:versionName="1.0.2">
<uses-sdk
android:minSdkVersion="21">
@@ -59,9 +59,6 @@
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.ACTION_SHUTDOWN" />
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
- <action android:name="android.provider.Telephony.SECRET_CODE"/>
- <data android:scheme="android_secret_code" android:host="442287"/>
- <category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
diff --git a/src/main/java/com/fairphone/hiccup/app/BoardDate.java b/src/main/java/com/fairphone/hiccup/app/BoardDate.java
index 5a51bdb..8ec3942 100644
--- a/src/main/java/com/fairphone/hiccup/app/BoardDate.java
+++ b/src/main/java/com/fairphone/hiccup/app/BoardDate.java
@@ -1,4 +1,4 @@
- package com.fairphone.hiccup.app;
+package com.fairphone.hiccup.app;
import android.util.Log;
@@ -7,8 +7,10 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.util.Calendar;
+import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.Locale;
+import java.util.TimeZone;
/**
* Copyright 2016 Fairphone B.V.
@@ -35,6 +37,9 @@
*/
private static final String BOARD_DATE_FILE = "/persist/board_date.bin";
+ private static final String BOARD_DATE_FORMAT = "yyyyMMddHH";
+ private static final String BOARD_DATE_TIMEZONE = "Asia/Shanghai";
+ private static final long DEFAULT_BOARD_DATE_TIMESTAMP = 0L;
private static Date boardDate = null;
@@ -48,16 +53,22 @@
}
private static Date readBoardDate() {
- long startTime = 0;
- try {
- byte[] boardFile = getBoardDateFileInByteArray();
+ Date boardDate;
- String strDate = bytesToHex(boardFile);
- startTime = getTimeInMilliseconds(strDate);
+ try {
+ final byte[] boardFile = getBoardDateFileInByteArray();
+ final String strDate = bytesToHex(boardFile);
+ final SimpleDateFormat format = new SimpleDateFormat(BOARD_DATE_FORMAT, Locale.US);
+ format.setTimeZone(TimeZone.getTimeZone(BOARD_DATE_TIMEZONE));
+
+ // we want to ignore the time for anonymity
+ boardDate = format.parse(strDate.substring(0,10));
} catch (Exception e) {
- Log.e(TAG,"Unknown error while reading board date; using default", e);
+ Log.e(TAG, "Unknown error while reading board date; using default", e);
+ boardDate = new Date(DEFAULT_BOARD_DATE_TIMESTAMP);
}
- return new Date(startTime);
+
+ return boardDate;
}
private static byte[] getBoardDateFileInByteArray()
@@ -89,24 +100,5 @@
}
return new String(hexChars);
}
-
- private static long getTimeInMilliseconds(String date)
- {
- Calendar cal = Calendar.getInstance();
-
- try {
- cal.set(Calendar.YEAR, Integer.parseInt(date.substring(0, 4)));
- cal.set(Calendar.MONTH, Integer.parseInt(date.substring(4, 6)));
- cal.set(Calendar.DAY_OF_MONTH, Integer.parseInt(date.substring(6, 8)));
- cal.set(Calendar.HOUR_OF_DAY, 0);
- cal.set(Calendar.MINUTE, 0);
- cal.set(Calendar.SECOND, 0);
- }
- catch (NumberFormatException e) {
- Log.e(TAG, "Parse Exception", e);
- return 0;
- }
- return cal.getTimeInMillis();
- }
}
diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml
index 0a56040..6cc2dbb 100644
--- a/src/main/res/values-de/strings.xml
+++ b/src/main/res/values-de/strings.xml
@@ -19,7 +19,7 @@
<string name="pref_cat_title_hiccup_reporting">Hiccup Stabilitätsberichte</string>
<string name="no_UUID_assigned_yet">Noch keine UUID zugewiesen.</string>
<string name="wizard_greeting">Hilf uns dein Fairphone zu verbessern</string>
- <string name="wizard_header">Hilf und dein Fairphone zu verbessern</string>
+ <string name="wizard_header">Hilf uns dein Fairphone zu verbessern</string>
<string name="next">Okay</string>
<string name="wizard_consent_question"><![CDATA[<p>Indem du automatisch Diagnosedaten an Fairphone sendest, hilfst du uns das Fairphone 2 zu verbessern. Diese Daten beinhalten keine persönlichen Informationen und unterstützen das Fairphone Softwareteam Probleme festzustellen und sie zu beheben. Für weitere Informationen besuche <b>fairphone.com/stability-reporting</b>.</p><p>Du kannst diese Einstellung jederzeit in Einstellungen -> Wartung -> Hiccup Stabilitätsberichte ändern.</p>]]></string>