diff --git a/BoardConfig.mk b/BoardConfig.mk index 12013f92..6556dded 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -49,6 +49,11 @@ TARGET_OMAP3 := true COMMON_GLOBAL_CFLAGS += -DTARGET_OMAP3 -DOMAP_COMPAT -DMOTOROLA_UIDS ARCH_ARM_HAVE_TLS_REGISTER := false +# FM radio +#BOARD_HAVE_FM_RADIO := true +#BOARD_FM_DEVICE := wl1271 +#BOARD_GLOBAL_CFLAGS += -DHAVE_FM_RADIO + # Wifi related defines BOARD_WLAN_DEVICE := wl1271 WPA_SUPPLICANT_VERSION := VER_0_6_X @@ -125,16 +130,6 @@ TARGET_CUSTOM_RELEASETOOL := ./device/motorola/jordan/releasetools/squisher # Jordan need 2nd-init binary from motorola common TARGET_NEEDS_MOTOROLA_HIJACK := true -# In nighly builds only -ifndef CYANOGEN_RELEASE - -#BOARD_HAVE_FM_RADIO := true -#BOARD_FM_DEVICE := wl1271 -#TARGET_GLOBAL_CFLAGS += -DHAVE_FM_RADIO -#TARGET_GLOBAL_CPPFLAGS += -DHAVE_FM_RADIO - -endif - # Gingerbread kernel specifics ifeq ($(BOARD_DEFY_MODEL),DEFY_GINGER) BOARD_USE_CID_ROTATE_34 := true diff --git a/DefyParts/AndroidManifest.xml b/DefyParts/AndroidManifest.xml index 61aa5d85..8b21157d 100644 --- a/DefyParts/AndroidManifest.xml +++ b/DefyParts/AndroidManifest.xml @@ -4,16 +4,26 @@ android:sharedUserId="android.uid.system"> + + + - - - + + + + + + + + + + + + diff --git a/DefyParts/res/values-de/strings.xml b/DefyParts/res/values-de/strings.xml index f3dc1e38..db2245b1 100644 --- a/DefyParts/res/values-de/strings.xml +++ b/DefyParts/res/values-de/strings.xml @@ -24,6 +24,11 @@ Warnung Das Erhöhen der Anzahl der Multi-Touch-Punkte kann die Reaktionsfähigkeit des Touchscreens verschlechtern.\nSind Sie sicher, die Einstellung verändern zu wollen? + Bootmenü + Bootmenü-PIN + Die Tastensequenz zum Bootmenü-Schutz kann aus folgenden Zeichen bestehen:\nM = Menü-Taste\nH = Home-Taste\nB = Zurück-Taste\nS = Such-Taste + Tastensequenz, um direkten Bootmenü-Zugriff zu schützen + Ton-Einstellungen Audio-Effekte @@ -66,4 +71,27 @@ Version Frequenz: %1$s MHz Unbekannt + + LTO-Daten-Download + Download von Hilfsdaten, die die GPS-Performance verbessern können + Automat. Download + Daten bei bestehender Netzverbindung automatisch downloaden + Download-Intervall + Intervall: %1$s + 12 Stunden + 1 Tag + 3 Tage + 1 Woche + 2 Wochen + 1 Monat + Datei-Typ + 7 Tage Gültigkeit + 30 Tage Gültigkeit + Nur über WLAN + AGPS-Daten nur via WLAN downloaden + Jetzt downloaden + Letzter Download: %1$s + Letzter Downloadversuch: %1$s (Nicht erfolgreich) + Daten werden heruntergeladen\u2026 (%1$s%%) + Nie diff --git a/DefyParts/res/values-zh-rTW/strings.xml b/DefyParts/res/values-zh-rTW/strings.xml index f7154fea..49ca1cfa 100644 --- a/DefyParts/res/values-zh-rTW/strings.xml +++ b/DefyParts/res/values-zh-rTW/strings.xml @@ -66,4 +66,27 @@ 版本 頻率: %1$s MHz 不明 + + LTO 長期軌道資料下載 + 下載長期軌道資料可以幫助提高 GPS 的效能 + 自動下載 + 若網路可用時,自動下載長期軌道資料 + 下載間隔 + 間隔: %1$s + 12 小時 + 1 天 + 3 天 + 1 週 + 2 週 + 1 個月 + 下載檔案類型 + 7 天有效期 + 30 天有效期 + 僅使用 Wifi 網路 + 僅使用 Wifi 網路下載長期軌道資料 + 立即下載 + 上一次更新: %1$s + 上一次嘗試下載: %1$s (失敗) + 下載中\u2026 (%1$s%%) + 永不執行 diff --git a/DefyParts/res/values/arrays.xml b/DefyParts/res/values/arrays.xml index 7688f15d..f78c6336 100644 --- a/DefyParts/res/values/arrays.xml +++ b/DefyParts/res/values/arrays.xml @@ -155,4 +155,32 @@ australia:australia:OPTUS 3.4.2-145:900,2100:australia/optus_342:80bf9284fd91f092888f2d5b9fc72e10 australia:australia:Telstra 2.26:850,2100:australia/telstra_226:170dec08e7e515806d2e193cab9a1b86 + + + @string/lto_download_interval_12hours + @string/lto_download_interval_1day + @string/lto_download_interval_3days + @string/lto_download_interval_1week + @string/lto_download_interval_2weeks + @string/lto_download_interval_1month + + + + 43200 + 86400 + 259200 + 604800 + 1209600 + 2592000 + + + + @string/lto_download_file_7days + @string/lto_download_file_30days + + + + 7day + 30day + diff --git a/DefyParts/res/values/strings.xml b/DefyParts/res/values/strings.xml index 37f1b089..02478171 100644 --- a/DefyParts/res/values/strings.xml +++ b/DefyParts/res/values/strings.xml @@ -25,6 +25,11 @@ Warning Increasing the number of touch points may degrade the responsiveness of the touch screen.\nAre you sure you want to change the setting? + Boot menu + Boot menu PIN + Please enter the sequence of keys that need to be entered when running bootmenu.\nM = Menu key\nH = home key\nB = back key\nS = search key + A sequence of keystrokes to protect direct boot menu access + Audio Settings Audio Effects and DSP @@ -67,4 +72,27 @@ Version Frequencies: %1$s MHz Unknown + + LTO Data Download + Download of assistive data which can help improving GPS performance + Automatic download + Download data automatically if a network connection is available + Download interval + Interval: %1$s + 12 hours + 1 day + 3 days + 1 week + 2 weeks + 1 month + Download file type + 7 days validity + 30 days validity + Wifi only + Only download assistive data over Wifi connection + Download now + Last download: %1$s + Last download attempt: %1$s (Unsuccessful) + Downloading data\u2026 (%1$s%%) + Never diff --git a/DefyParts/res/xml/settings.xml b/DefyParts/res/xml/settings.xml index 691b758d..3e74ce57 100644 --- a/DefyParts/res/xml/settings.xml +++ b/DefyParts/res/xml/settings.xml @@ -30,14 +30,27 @@ + + + + + + + android:targetPackage="com.motorola.android.AudioEffectSettings" + android:targetClass="com.motorola.android.AudioEffectSettings.DeviceListActivity" /> @@ -53,6 +66,38 @@ android:targetClass="com.motorola.CompassCalibrate.CompassCalibrate" /> + + + + + + + + + + + + + + { + private String mSource; + private File mDestination; + private File mTempFile; + private WakeLock mWakeLock; + + private static final int RESULT_SUCCESS = 0; + private static final int RESULT_FAILURE = 1; + private static final int RESULT_CANCELLED = 2; + + public LtoDownloadTask(String source, File destination) { + mSource = source; + mDestination = destination; + try { + mTempFile = File.createTempFile("lto-download", null, getCacheDir()); + } catch (IOException e) { + Log.w(TAG, "Could not create temporary file", e); + } + + PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE); + mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG); + } + + @Override + protected void onPreExecute() { + mWakeLock.acquire(); + reportStateChange(STATE_DOWNLOADING, null, null); + } + + @Override + protected Integer doInBackground(Void... params) { + BufferedInputStream in = null; + BufferedOutputStream out = null; + int result = RESULT_SUCCESS; + + try { + HttpParams httpParams = new BasicHttpParams(); + HttpConnectionParams.setConnectionTimeout(httpParams, DOWNLOAD_TIMEOUT); + HttpConnectionParams.setSoTimeout(httpParams, DOWNLOAD_TIMEOUT); + + HttpClient client = new DefaultHttpClient(httpParams); + HttpGet request = new HttpGet(); + request.setURI(new URI(mSource)); + + HttpResponse response = client.execute(request); + HttpEntity entity = response.getEntity(); + File outputFile = mTempFile != null ? mTempFile : mDestination; + + in = new BufferedInputStream(entity.getContent()); + out = new BufferedOutputStream(new FileOutputStream(outputFile)); + + byte[] buffer = new byte[2048]; + int count, total = 0; + long length = entity.getContentLength(); + + while ((count = in.read(buffer, 0, buffer.length)) != -1) { + if (isCancelled()) { + result = RESULT_CANCELLED; + break; + } + out.write(buffer, 0, count); + total += count; + + if (length > 0) { + float progress = (float) total * 100 / length; + publishProgress((int) progress); + } + } + + Log.d(TAG, "Downloaded " + total + "/" + length + " bytes of LTO data"); + if (total == 0 || (length > 0 && total != length)) { + result = RESULT_FAILURE; + } + in.close(); + out.close(); + } catch (IOException e) { + Log.w(TAG, "Failed downloading LTO data", e); + result = RESULT_FAILURE; + } catch (URISyntaxException e) { + Log.e(TAG, "URI syntax wrong", e); + result = RESULT_FAILURE; + } finally { + try { + if (in != null) { + in.close(); + } + if (out != null) { + out.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + Log.d(TAG, "return " + result); + return result; + } + + @Override + protected void onProgressUpdate(Integer... progress) { + reportStateChange(STATE_DOWNLOADING, null, progress[0]); + } + + @Override + protected void onPostExecute(Integer result) { + if (result != null && result != RESULT_CANCELLED) { + finish(result); + } + } + + @Override + protected void onCancelled() { + finish(RESULT_CANCELLED); + } + + private void finish(int result) { + if (mTempFile != null) { + if (result == RESULT_SUCCESS) { + mDestination.delete(); + if (!mTempFile.renameTo(mDestination)) { + Log.w(TAG, "Could not move temporary file to destination"); + } else { + mDestination.setReadable(true, false); + } + } + mTempFile.delete(); + } else if (result != RESULT_SUCCESS) { + mDestination.delete(); + } else { + mDestination.setReadable(true, false); + } + + Context context = LtoDownloadService.this; + + if (result == RESULT_SUCCESS) { + long now = System.currentTimeMillis(); + SharedPreferences.Editor editor = + PreferenceManager.getDefaultSharedPreferences(context).edit(); + + editor.putLong(KEY_LAST_DOWNLOAD, now); + editor.apply(); + + LtoDownloadUtils.scheduleNextDownload(context, now); + } else if (result == RESULT_FAILURE) { + /* failure, schedule next download in 1 hour */ + long lastDownload = LtoDownloadUtils.getLastDownload(context); + lastDownload += 60 * 60 * 1000; + LtoDownloadUtils.scheduleNextDownload(context, lastDownload); + } else { + /* cancelled, likely due to lost network - we'll get restarted + * when network comes back */ + } + + reportStateChange(STATE_IDLE, result == RESULT_SUCCESS, null); + mWakeLock.release(); + stopSelf(); + } + } + + private void reportStateChange(int state, Boolean success, Integer progress) { + Intent intent = new Intent(ACTION_STATE_CHANGE); + intent.putExtra(EXTRA_STATE, state); + if (success != null) { + intent.putExtra(EXTRA_SUCCESS, success); + } + if (progress != null) { + intent.putExtra(EXTRA_PROGRESS, progress); + } + intent.putExtra(EXTRA_TIMESTAMP, new Date().getTime()); + sendStickyBroadcast(intent); + } +} diff --git a/DefyParts/src/com/cyanogenmod/defyparts/LtoDownloadUtils.java b/DefyParts/src/com/cyanogenmod/defyparts/LtoDownloadUtils.java new file mode 100644 index 00000000..39176a59 --- /dev/null +++ b/DefyParts/src/com/cyanogenmod/defyparts/LtoDownloadUtils.java @@ -0,0 +1,41 @@ +package com.cyanogenmod.defyparts; + +import android.app.AlarmManager; +import android.app.PendingIntent; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.preference.PreferenceManager; +import android.util.Log; + +public class LtoDownloadUtils { + private static final String TAG = "LtoDownloadUtils"; + private static final long DOWNLOAD_INTERVAL_DEFAULT = 3600 * 24 * 3 * 1000; /* 3 days */ + + static long getLastDownload(Context context) { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + return prefs.getLong(LtoDownloadService.KEY_LAST_DOWNLOAD, 0); + } + + static long getDownloadInterval(Context context) { + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + String value = prefs.getString(LtoDownloadService.KEY_INTERVAL, null); + if (value != null) { + try { + return Long.parseLong(value) * 1000; + } catch (NumberFormatException e) { + Log.w(TAG, "Found invalid interval " + value); + } + } + return DOWNLOAD_INTERVAL_DEFAULT; + } + + static void scheduleNextDownload(Context context, long lastDownload) { + AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); + Intent intent = new Intent(context, LtoDownloadService.class); + PendingIntent pi = PendingIntent.getService(context, 0, intent, + PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT); + + am.set(AlarmManager.RTC, lastDownload + getDownloadInterval(context), pi); + } +} diff --git a/DefyParts/src/com/cyanogenmod/defyparts/LtoReceiver.java b/DefyParts/src/com/cyanogenmod/defyparts/LtoReceiver.java new file mode 100644 index 00000000..24cd4079 --- /dev/null +++ b/DefyParts/src/com/cyanogenmod/defyparts/LtoReceiver.java @@ -0,0 +1,35 @@ +package com.cyanogenmod.defyparts; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.util.Log; + +public class LtoReceiver extends BroadcastReceiver { + private static final String TAG = "LtoReceiver"; + + @Override + public void onReceive(Context context, Intent intent) { + final String action = intent.getAction(); + + if (ConnectivityManager.CONNECTIVITY_ACTION.equals(action)) { + boolean hasConnection = + !intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false); + + Log.d(TAG, "Got connectivity change, has connection: " + hasConnection); + Intent serviceIntent = new Intent(context, LtoDownloadService.class); + + if (hasConnection) { + context.startService(serviceIntent); + } else { + context.stopService(serviceIntent); + } + } else if (Intent.ACTION_BOOT_COMPLETED.equals(action)) { + long lastDownload = LtoDownloadUtils.getLastDownload(context); + LtoDownloadUtils.scheduleNextDownload(context, lastDownload); + } + + } +} diff --git a/DefyParts/src/com/cyanogenmod/defyparts/SettingsActivity.java b/DefyParts/src/com/cyanogenmod/defyparts/SettingsActivity.java index 4b201d6f..b97f1e41 100644 --- a/DefyParts/src/com/cyanogenmod/defyparts/SettingsActivity.java +++ b/DefyParts/src/com/cyanogenmod/defyparts/SettingsActivity.java @@ -1,42 +1,87 @@ package com.cyanogenmod.defyparts; import android.app.AlertDialog; +import android.content.BroadcastReceiver; +import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.content.IntentFilter; +import android.content.SharedPreferences; +import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.content.pm.PackageManager; +import android.content.res.Resources; import android.os.Bundle; import android.os.PowerManager; import android.os.SystemProperties; import android.preference.CheckBoxPreference; +import android.preference.EditTextPreference; import android.preference.ListPreference; import android.preference.Preference; import android.preference.Preference.OnPreferenceChangeListener; import android.preference.PreferenceActivity; -import android.preference.PreferenceCategory; +import android.preference.PreferenceManager; +import android.preference.PreferenceScreen; +import android.text.InputFilter; +import android.text.InputType; +import android.text.method.NumberKeyListener; import android.text.TextUtils; import android.util.Log; +import java.io.BufferedReader; import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; +import java.text.DateFormat; +import java.util.Date; -public class SettingsActivity extends PreferenceActivity implements OnPreferenceChangeListener { +public class SettingsActivity extends PreferenceActivity + implements OnPreferenceChangeListener, OnSharedPreferenceChangeListener { private static final String TAG = "DefyParts"; private PackageManager mPm; - private PreferenceCategory generalSettings; private ListPreference chargeLedModePref; private ListPreference touchPointsPref; private CheckBoxPreference kinetoPref; private Preference basebandPref; + private EditTextPreference bootmenuPinPref; + + private CheckBoxPreference mLtoDownloadEnabledPref; + private ListPreference mLtoDownloadIntervalPref; + private ListPreference mLtoDownloadFilePref; + private CheckBoxPreference mLtoDownloadWifiOnlyPref; + private Preference mLtoDownloadNowPref; private static final String PROP_CHARGE_LED_MODE = "persist.sys.charge_led"; private static final String PROP_TOUCH_POINTS = "persist.sys.multitouch"; private static final String PROP_KINETO_ENABLED = "persist.sys.kineto.enable"; private static final String FILE_TOUCH_POINTS = "/proc/multitouch/num"; + private static final String FILE_BOOTMENU_PIN = "/data/secure/bootmenu_pin"; private static final String KINETO_PACKAGE = "com.android.kineto"; + private static final char[] BOOTMENU_PIN_ALLOWED_CHARS = new char[] { + 'M', 'H', 'B', 'S' + }; + + private BroadcastReceiver mLtoStateReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + int state = intent.getIntExtra(LtoDownloadService.EXTRA_STATE, LtoDownloadService.STATE_IDLE); + + mLtoDownloadNowPref.setEnabled(state == LtoDownloadService.STATE_IDLE); + if (state == LtoDownloadService.STATE_IDLE) { + boolean success = intent.getBooleanExtra(LtoDownloadService.EXTRA_SUCCESS, true); + long timestamp = intent.getLongExtra(LtoDownloadService.EXTRA_TIMESTAMP, 0); + updateLtoDownloadDateSummary(success, timestamp == 0 ? null : new Date(timestamp)); + } else { + int progress = intent.getIntExtra(LtoDownloadService.EXTRA_PROGRESS, 0); + updateLtoDownloadProgressSummary(progress); + } + } + }; + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -44,17 +89,40 @@ public void onCreate(Bundle savedInstanceState) { mPm = getPackageManager(); - generalSettings = (PreferenceCategory) getPreferenceScreen().findPreference("general"); - chargeLedModePref = (ListPreference) generalSettings.findPreference("charge_led_mode"); + PreferenceScreen prefs = getPreferenceScreen(); + + chargeLedModePref = (ListPreference) prefs.findPreference("charge_led_mode"); chargeLedModePref.setOnPreferenceChangeListener(this); - touchPointsPref = (ListPreference) generalSettings.findPreference("touch_points"); + touchPointsPref = (ListPreference) prefs.findPreference("touch_points"); touchPointsPref.setOnPreferenceChangeListener(this); - PreferenceCategory otherSettings = (PreferenceCategory) getPreferenceScreen().findPreference("other"); - kinetoPref = (CheckBoxPreference) otherSettings.findPreference("kineto"); + kinetoPref = (CheckBoxPreference) prefs.findPreference("kineto"); kinetoPref.setOnPreferenceChangeListener(this); - basebandPref = otherSettings.findPreference("baseband_selection"); + basebandPref = prefs.findPreference("baseband_selection"); basebandPref.setOnPreferenceChangeListener(this); + + bootmenuPinPref = (EditTextPreference) prefs.findPreference("bootmenu_pin"); + bootmenuPinPref.setOnPreferenceChangeListener(this); + bootmenuPinPref.getEditText().setFilters(new InputFilter[] { new NumberKeyListener() { + @Override + public int getInputType() { + return InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS; + } + @Override + protected char[] getAcceptedChars() { + return BOOTMENU_PIN_ALLOWED_CHARS; + } + }}); + + mLtoDownloadEnabledPref = (CheckBoxPreference) prefs.findPreference("lto_download_enabled"); + mLtoDownloadEnabledPref.setOnPreferenceChangeListener(this); + mLtoDownloadIntervalPref = (ListPreference) prefs.findPreference("lto_download_interval"); + mLtoDownloadIntervalPref.setOnPreferenceChangeListener(this); + mLtoDownloadFilePref = (ListPreference) prefs.findPreference("lto_download_file"); + mLtoDownloadFilePref.setOnPreferenceChangeListener(this); + mLtoDownloadWifiOnlyPref = (CheckBoxPreference) prefs.findPreference("lto_download_wifi_only"); + mLtoDownloadWifiOnlyPref.setOnPreferenceChangeListener(this); + mLtoDownloadNowPref = prefs.findPreference("lto_download_now"); } @Override @@ -63,6 +131,12 @@ public void onResume() { chargeLedModePref.setValue(SystemProperties.get(PROP_CHARGE_LED_MODE)); touchPointsPref.setValue(SystemProperties.get(PROP_TOUCH_POINTS)); + bootmenuPinPref.setText(readLineFromFile(FILE_BOOTMENU_PIN)); + updateLtoDownloadDateSummary(true, null); + updateLtoIntervalSummary(); + + getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this); + registerReceiver(mLtoStateReceiver, new IntentFilter(LtoDownloadService.ACTION_STATE_CHANGE)); try { int setting = mPm.getApplicationEnabledSetting(KINETO_PACKAGE); @@ -74,10 +148,26 @@ public void onResume() { } } + @Override + public void onPause() { + super.onPause(); + unregisterReceiver(mLtoStateReceiver); + getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this); + } + + @Override + public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference preference) { + if (preference == mLtoDownloadNowPref) { + invokeLtoDownloadService(true); + return true; + } + return false; + } + @Override public boolean onPreferenceChange(Preference preference, Object newValue) { if (preference == chargeLedModePref) { - SystemProperties.set(PROP_CHARGE_LED_MODE, (String) newValue); + SystemProperties.set(PROP_CHARGE_LED_MODE, (String) newValue, true); /* make NotificationManagerService update the LED, so the new setting takes effect */ sendBroadcast(new Intent("com.android.server.NotificationManagerService.UPDATE_LED")); } else if (preference == touchPointsPref) { @@ -105,6 +195,9 @@ public void onClick(DialogInterface dialog, int which) { dialog.show(); return false; } + } else if (preference == bootmenuPinPref) { + Log.d(TAG, "pin changed -> " + newValue); + writeValueToFile(FILE_BOOTMENU_PIN, (String) newValue); } else if (preference == kinetoPref) { final Boolean value = (Boolean) newValue; final int setting = value ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : @@ -115,11 +208,65 @@ public void onClick(DialogInterface dialog, int which) { showRebootPrompt(); } else if (preference == basebandPref) { showRebootPrompt(); + } else if (preference == mLtoDownloadEnabledPref + || preference == mLtoDownloadIntervalPref + || preference == mLtoDownloadFilePref + || preference == mLtoDownloadWifiOnlyPref) { + invokeLtoDownloadService(false); } return true; } + @Override + public void onSharedPreferenceChanged(SharedPreferences pref, String key) { + if (key.equals(mLtoDownloadIntervalPref.getKey())) { + updateLtoIntervalSummary(); + } + } + + private void updateLtoIntervalSummary() { + CharSequence value = mLtoDownloadIntervalPref.getEntry(); + mLtoDownloadIntervalPref.setSummary( + getResources().getString(R.string.lto_download_interval_summary, value)); + } + + private void updateLtoDownloadProgressSummary(int progress) { + mLtoDownloadNowPref.setSummary( + getResources().getString(R.string.lto_downloading_data, progress)); + } + + private void updateLtoDownloadDateSummary(boolean success, Date timestamp) { + Resources res = getResources(); + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); + final String lastDownloadString; + int resId = R.string.lto_last_download_date; + + if (timestamp == null) { + long lastDownload = prefs.getLong(LtoDownloadService.KEY_LAST_DOWNLOAD, 0); + if (lastDownload != 0) { + timestamp = new Date(lastDownload); + } + } + + if (timestamp != null) { + lastDownloadString = DateFormat.getDateTimeInstance().format(timestamp); + if (!success) { + resId = R.string.lto_last_download_date_failure; + } + } else { + lastDownloadString = res.getString(R.string.never); + } + + mLtoDownloadNowPref.setSummary(res.getString(resId, lastDownloadString)); + } + + private void invokeLtoDownloadService(boolean forceDownload) { + Intent intent = new Intent(this, LtoDownloadService.class); + intent.putExtra(LtoDownloadService.EXTRA_FORCE_DOWNLOAD, forceDownload); + startService(intent); + } + private void showRebootPrompt() { AlertDialog dialog = new AlertDialog.Builder(this) .setTitle(R.string.reboot_prompt_title) @@ -142,20 +289,48 @@ private void setTouchPointSetting(String value) { SystemProperties.set(PROP_TOUCH_POINTS, value); /* and also write it into the file to make it apply instantly */ - File touchPointsFile = new File(FILE_TOUCH_POINTS); + writeValueToFile(FILE_TOUCH_POINTS, value); + } + + private String readLineFromFile(String path) { + String result = null; + File inFile = new File(path); + BufferedReader reader = null; + + try { + reader = new BufferedReader(new FileReader(inFile)); + result = reader.readLine(); + } catch (FileNotFoundException e) { + } catch (IOException e) { + Log.e(TAG, "Could not read from file " + path, e); + } finally { + if (reader != null) { + try { + reader.close(); + } catch (IOException e) { + Log.w(TAG, "Closing the file " + path + " failed.", e); + } + } + } + + return result; + } + + private void writeValueToFile(String path, String value) { + File outFile = new File(path); FileWriter writer = null; + try { - writer = new FileWriter(touchPointsFile); + writer = new FileWriter(outFile); writer.write(value); } catch (IOException e) { - Log.e(TAG, "Could not apply touch point setting.", e); - return; + Log.e(TAG, "Could not write to file " + path, e); } finally { if (writer != null) { try { writer.close(); } catch (IOException e) { - Log.w(TAG, "Closing the touch point file failed.", e); + Log.w(TAG, "Closing the file " + path + " failed.", e); } } } diff --git a/bootmenu/config/default.prop b/bootmenu/config/default.prop index 271f7ea8..2190b92d 100644 --- a/bootmenu/config/default.prop +++ b/bootmenu/config/default.prop @@ -1,9 +1,9 @@ # # ADDITIONAL_DEFAULT_PROPERTIES (From bootmenu/config) # -ro.secure=0 +ro.secure=1 ro.allow.mock.location=0 -ro.debuggable=0 +ro.debuggable=1 persist.service.adb.enable=1 # Forbid format of these partitions in mount menu (use only rm -r) diff --git a/bootmenu/script/pre_bootmenu.sh b/bootmenu/script/pre_bootmenu.sh index bd5d8146..d2075c64 100644 --- a/bootmenu/script/pre_bootmenu.sh +++ b/bootmenu/script/pre_bootmenu.sh @@ -60,12 +60,18 @@ chmod 4755 /sbin/adbd.root rm -f /default.prop cp -f $BM_ROOTDIR/config/default.prop /default.prop -## mount cache +## mount cache & data mkdir -p /cache +mkdir -p /data # stock mount, with fsck if [ -x /system/bin/mount_ext3.sh ]; then /system/bin/mount_ext3.sh cache /cache + /system/bin/mount_ext3.sh data /data +fi + +if [ ! -d /data/data ]; then + mount -t $FS_DATA -o noatime,nodiratime,errors=continue $PART_DATA /data fi # mount cache for boot mode and recovery logs @@ -73,6 +79,7 @@ if [ ! -d /cache/recovery ]; then mount -t $FS_CACHE -o nosuid,nodev,noatime,nodiratime,barrier=1 $PART_CACHE /cache fi + mkdir -p /cache/bootmenu # load ondemand safe settings to reduce heat and battery use diff --git a/jordan-blobs.mk b/jordan-blobs.mk index d2e9390b..c025d8fa 100644 --- a/jordan-blobs.mk +++ b/jordan-blobs.mk @@ -27,7 +27,6 @@ PRODUCT_COPY_FILES += \ device/motorola/jordan/bootmenu/recovery/recovery.fstab:system/etc/recovery.fstab \ device/motorola/jordan/prebuilt/etc/init.d/00baseband:system/etc/init.d/00baseband \ device/motorola/jordan/prebuilt/etc/init.d/01sysctl:system/etc/init.d/01sysctl \ - device/motorola/jordan/prebuilt/etc/init.d/03adbd:system/etc/init.d/03adbd \ device/motorola/jordan/prebuilt/etc/init.d/05mountsd:system/etc/init.d/05mountsd \ device/motorola/jordan/prebuilt/etc/init.d/08backlight:system/etc/init.d/08backlight \ device/motorola/jordan/prebuilt/etc/init.d/80kineto:system/etc/init.d/80kineto \ @@ -52,9 +51,4 @@ else PRODUCT_COPY_FILES += device/motorola/jordan/releasetools/custom_backup_list.txt:system/etc/custom_backup_list.txt endif -# App -PRODUCT_COPY_FILES += \ - device/motorola/jordan/prebuilt/app/DroidSSHd.apk:system/app/DroidSSHd.apk \ - device/motorola/jordan/prebuilt/lib/libNativeSSHd.so:system/lib/libNativeSSHd.so \ - #end of jordan-blobs.mk diff --git a/jordan.mk b/jordan.mk index e4a3502c..011270c2 100644 --- a/jordan.mk +++ b/jordan.mk @@ -43,7 +43,6 @@ PRODUCT_PROPERTY_OVERRIDES += \ ro.media.dec.vid.wmv.enabled=1 \ dalvik.vm.lockprof.threshold=500 \ ro.kernel.android.checkjni=0 \ - dalvik.vm.dexopt-data-only=1 \ ro.vold.umsdirtyratio=20 DEVICE_PACKAGE_OVERLAYS += device/motorola/jordan/overlay @@ -70,6 +69,7 @@ PRODUCT_PACKAGES += \ wlan_cu \ libtiOsLib \ wlan_loader \ + tiap_loader \ libCustomWifi \ wpa_supplicant.conf \ dhcpcd.conf \ @@ -93,6 +93,8 @@ PRODUCT_PACKAGES += \ hostapd.conf \ libhostapdcli \ DefyParts \ + MotoFM \ + MotoFMService \ Usb \ su \ mot_boot_mode \ @@ -101,6 +103,12 @@ PRODUCT_PACKAGES += \ # for jpeg hw encoder/decoder # PRODUCT_PACKAGES += libskiahw libOMX.TI.JPEG.Encoder libOMX.TI.JPEG.decoder +# add bash +PRODUCT_PACKAGES += bash + +# Add DroidSSHd (dropbear) Management App - tpruvot/android_external_droidsshd @ github +PRODUCT_PACKAGES += DroidSSHd dropbear + # hw video prepost processor (require dsp lib) # PRODUCT_PACKAGES += libOMX.TI.VPP @@ -140,7 +148,6 @@ PRODUCT_PACKAGES += \ PRODUCT_COPY_FILES += \ packages/wallpapers/LivePicker/android.software.live_wallpaper.xml:/system/etc/permissions/android.software.live_wallpaper.xml - $(call inherit-product, build/target/product/full_base.mk) # Should be after the full_base include, which loads languages_full diff --git a/libcamera/JordanCameraWrapper.cpp b/libcamera/JordanCameraWrapper.cpp index 9da50614..b6b5da46 100644 --- a/libcamera/JordanCameraWrapper.cpp +++ b/libcamera/JordanCameraWrapper.cpp @@ -153,6 +153,13 @@ JordanCameraWrapper::JordanCameraWrapper(sp& motoInterf { if (type == CAM_SOC) { mTorchThread = new TorchEnableThread(this); + + /* The camera lib initializes focus-mode with the value 'on', which is not in its + * own focus-mode-values list :-( + */ + CameraParameters params = motoInterface->getParameters(); + params.set(CameraParameters::KEY_FOCUS_MODE, CameraParameters::FOCUS_MODE_AUTO); + motoInterface->setParameters(params); } } diff --git a/libfnc/libfnc.c b/libfnc/libfnc.c index fa824dc1..fecc6208 100644 --- a/libfnc/libfnc.c +++ b/libfnc/libfnc.c @@ -111,3 +111,89 @@ return 0 ; return 0 ; } +//libmetainfo.so + int MM_MediaExtractor_DetectMediaType() +{ + LOGE(__func__); +return 0; +} + + int MM_MediaExtractor_GetTrackType() +{ + LOGE(__func__); +return 0; +} + +//libjanus.so + int WMDRM_MTPE_CleanDataStore() +{ + LOGE(__func__); +return 0; +} + + int WMDRM_MTPE_GetDeviceCertification() +{ + LOGE(__func__); +return 0; +} + + int WMDRM_MTPE_GetLicenseState() +{ + LOGE(__func__); +return 0; +} + + int WMDRM_MTPE_GetMeterChallenge() +{ + LOGE(__func__); +return 0; +} + + int WMDRM_MTPE_GetSecClock() +{ + LOGE(__func__); +return 0; +} + + int WMDRM_MTPE_GetSecureTimeChallenge() +{ + LOGE(__func__); +return 0; +} + + int WMDRM_MTPE_GetSyncList() +{ + LOGE(__func__); +return 0; +} + + int WMDRM_MTPE_SendWMDRMPDCommand() +{ + LOGE(__func__); +return 0; +} + + int WMDRM_MTPE_SendWMDRMPDRequest() +{ + LOGE(__func__); +return 0; +} + + int WMDRM_MTPE_SetLicenseResponse() +{ + LOGE(__func__); +return 0; +} + + int WMDRM_MTPE_SetMeterResponse() +{ + LOGE(__func__); +return 0; +} + + int WMDRM_MTPE_SetSecureTimeResponse() +{ + LOGE(__func__); +return 0; +} + diff --git a/libsensors/sensors.c b/libsensors/sensors.c index 74b175c1..d2bda75a 100644 --- a/libsensors/sensors.c +++ b/libsensors/sensors.c @@ -14,6 +14,7 @@ * limitations under the License. */ +#include #include #include "nusensors.h" @@ -75,15 +76,16 @@ static const struct sensor_t sSensorList[] = { 1, SENSORS_HANDLE_BASE + SENSOR_TYPE_AMBIENT_TEMPERATURE, SENSOR_TYPE_AMBIENT_TEMPERATURE, 85.0f, 1.0f, 0.2f, 0, { } }, - { "ISL29030 Proximity Sensor", - "Intersil Corporation", - 1, SENSORS_HANDLE_BASE + SENSOR_TYPE_PROXIMITY, SENSOR_TYPE_PROXIMITY, - 100.0f, 1.0f, 25.0f, 0, { } }, // (IR LED can use a lot of battery) - { "ISL29030 Light Sensor", "Intersil Corporation", 1, SENSORS_HANDLE_BASE + SENSOR_TYPE_LIGHT, SENSOR_TYPE_LIGHT, 8192.0f, 1.0f, 0.5f, 0, { } }, + + /* must be kept as the last one */ + { "ISL29030 Proximity Sensor", + "Intersil Corporation", + 1, SENSORS_HANDLE_BASE + SENSOR_TYPE_PROXIMITY, SENSOR_TYPE_PROXIMITY, + 100.0f, 1.0f, 25.0f, 0, { } }, // (IR LED can use a lot of battery) }; /*****************************************************************************/ @@ -94,8 +96,17 @@ static int open_sensors(const struct hw_module_t* module, const char* name, static int sensors__get_sensors_list(struct sensors_module_t* module, struct sensor_t const** list) { + int count = ARRAY_SIZE(sSensorList); + char disable_proximity[PROPERTY_VALUE_MAX]; + *list = sSensorList; - return ARRAY_SIZE(sSensorList); + if (property_get("hw.sensor.proximity.disable", disable_proximity, NULL)) { + if (strcmp(disable_proximity, "true") == 0) { + /* hide proximity sensor, which is the last one in the list, from sensorservice */ + count--; + } + } + return count; } static struct hw_module_methods_t sensors_module_methods = { diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 8d62663a..c3914f47 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -32,13 +32,17 @@ true - 150 + 200 - 300 + 400 - 400 + 500 + + + 150 + 220 @@ -344,4 +348,6 @@ /system/framework/com.motorola.android.location.jar:com.android.server.LocationProxyService + + true diff --git a/overlay/packages/apps/DSPManager/res/xml/main_preferences.xml b/overlay/packages/apps/DSPManager/res/xml/main_preferences.xml deleted file mode 100644 index 3fa691b3..00000000 --- a/overlay/packages/apps/DSPManager/res/xml/main_preferences.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/overlay/packages/apps/Settings/res/values/bools.xml b/overlay/packages/apps/Settings/res/values/bools.xml index 9697c077..42582007 100644 --- a/overlay/packages/apps/Settings/res/values/bools.xml +++ b/overlay/packages/apps/Settings/res/values/bools.xml @@ -19,5 +19,5 @@ constantly --> true - true + false diff --git a/prebuilt/app/DroidSSHd.apk b/prebuilt/app/DroidSSHd.apk deleted file mode 100644 index 14c0461c..00000000 Binary files a/prebuilt/app/DroidSSHd.apk and /dev/null differ diff --git a/prebuilt/etc/gpsconfig.xml b/prebuilt/etc/gpsconfig.xml index a978e1ed..b034a38b 100644 --- a/prebuilt/etc/gpsconfig.xml +++ b/prebuilt/etc/gpsconfig.xml @@ -1,31 +1,36 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/prebuilt/lib/libNativeSSHd.so b/prebuilt/lib/libNativeSSHd.so deleted file mode 100644 index 56fb7499..00000000 Binary files a/prebuilt/lib/libNativeSSHd.so and /dev/null differ diff --git a/profiles/2nd-init/init.mapphone_umts.rc b/profiles/2nd-init/init.mapphone_umts.rc index f6e6e348..b8144a7b 100644 --- a/profiles/2nd-init/init.mapphone_umts.rc +++ b/profiles/2nd-init/init.mapphone_umts.rc @@ -83,7 +83,8 @@ on post-fs chown radio radio /data/bp_nvm chmod 0770 /data/bp_nvm # create location directory - mkdir /data/location 0771 radio radio + mkdir /data/location 0771 radio system + chown radio system /data/location # create opprof directory mkdir /data/opprof 0770 radio shell # create dropbear directory @@ -217,6 +218,13 @@ service iprenew_tiwlan0 /system/bin/dhcpcd -n disabled oneshot +# Logging daemon +on property:persist.service.aplogd.enable=1 + start aplogd + +on property:persist.service.aplogd.enable=0 + stop aplogd + service baseimage /system/bin/dspexec -T /system/lib/dsp/baseimage.dof user media group media graphics diff --git a/releasetools/custom_backup_list.txt b/releasetools/custom_backup_list.txt index 98505d81..3d7ed986 100644 --- a/releasetools/custom_backup_list.txt +++ b/releasetools/custom_backup_list.txt @@ -38,3 +38,6 @@ etc/motorola/bp_nvm_default/File_Audio3_AMR_WB etc/motorola/bp_nvm_default/File_Audio4_AMR_WB etc/motorola/bp_nvm_default/File_Audio5_AMR_WB etc/motorola/bp_nvm_default/generic_pds_init +fonts/DroidSans.ttf +fonts/DroidSans-Bold.ttf +fonts/Clockopia.ttf diff --git a/releasetools/multiboot_backup_list.txt b/releasetools/multiboot_backup_list.txt index ef423e52..eafc0a05 100644 --- a/releasetools/multiboot_backup_list.txt +++ b/releasetools/multiboot_backup_list.txt @@ -1,14 +1,19 @@ bootmenu/script/2nd-system.sh -bootmenu/config/multiboot_defaultpath.conf +bootmenu/config/multiboot.conf bootmenu/binary/multiboot -bootmenu/2nd-system/fshook.functions.sh +bootmenu/2nd-system/2nd-init +bootmenu/2nd-system/errormessage +bootmenu/2nd-system/fshook.bootcyanogenrom.sh bootmenu/2nd-system/fshook.bootrecovery.sh -bootmenu/2nd-system/init.hook.rc -bootmenu/2nd-system/fshook.prevent_unmount.sh -bootmenu/2nd-system/fshook.edit_devtree.sh +bootmenu/2nd-system/fshook.bootstockrom.sh bootmenu/2nd-system/fshook.config.sh +bootmenu/2nd-system/fshook.edit_devtree.sh +bootmenu/2nd-system/fshook.functions.sh bootmenu/2nd-system/fshook.postfshook.sh +bootmenu/2nd-system/fshook.prevent_unmount.sh +bootmenu/2nd-system/init.hook.rc bootmenu/2nd-system/recovery/sbin/recoveryexit.sh +bootmenu/2nd-system/recovery/res/images/android.png bootmenu/2nd-system/recovery/res/images/icon_bootmenu.png bootmenu/2nd-system/recovery/res/images/icon_clockwork.png diff --git a/releasetools/squisher b/releasetools/squisher index 80297320..cdee7d6d 100755 --- a/releasetools/squisher +++ b/releasetools/squisher @@ -178,7 +178,8 @@ rm -rf $REPACK/ota/recovery # Determine what to name the new signed package MODVERSION=`sed -n -e'/ro\.modversion/s/^.*CyanogenMod-//p' $REPACK/ota/system/build.prop` -OUTFILE=$OUT/cm-$MODVERSION.zip +: ${MODVERSION:=nightly} +OUTFILE=$OUT/cm-$MODVERSION-signed.zip if [ -n "$CM_NIGHTLY_BOOT" ]; then MODVERSION=`echo $MODVERSION | sed -r 's/NIGHTLY/BOOT'$CM_NIGHTLY_BOOT'/'` diff --git a/releasetools/squisher.sh b/releasetools/squisher.sh index f9671347..c50da4fc 100644 --- a/releasetools/squisher.sh +++ b/releasetools/squisher.sh @@ -30,12 +30,12 @@ cp -f $DEVICE_TOP/releasetools/updater-script $REPACK/ota/META-INF/com/google/an cat $DEVICE_TOP/releasetools/multiboot_backup_list.txt >> $REPACK/ota/system/etc/custom_backup_list.txt # release builds contains a kernel, and do not backup kernel modules -if [ -n "$CYANOGEN_RELEASE" ]; then +#if [ -n "$CYANOGEN_RELEASE" ]; then cat $DEVICE_TOP/releasetools/updater-script-rel >> $REPACK/ota/META-INF/com/google/android/updater-script - cp -f $VENDOR_TOP/boot-222-179-4.smg $REPACK/ota/boot.img + cp -f $VENDOR_TOP/boot-222-177.smg $REPACK/ota/boot.img cp -f $VENDOR_TOP/devtree-222-179-2.smg $REPACK/ota/devtree.img - cp -f $DEVICE_TOP/logo-google.raw $REPACK/ota/logo.img -fi + cp -f $VENDOR_TOP/logo-moto.raw $REPACK/ota/logo.img +#fi cp -f $DEVICE_OUT/root/init $REPACK/ota/system/bootmenu/2nd-init/init cp -f $DEVICE_OUT/root/init.rc $REPACK/ota/system/bootmenu/2nd-init/init.rc diff --git a/releasetools/updater-script b/releasetools/updater-script index e9afe2ff..0931d73c 100644 --- a/releasetools/updater-script +++ b/releasetools/updater-script @@ -10,7 +10,6 @@ delete_recursive("/system/"); show_progress(0.750000, 35); package_extract_dir("system", "/system"); show_progress(0.050000, 2); -run_program("/sbin/touch","/system/firstboot"); symlink("busybox", "/system/xbin/[", "/system/xbin/[[", "/system/xbin/arp", "/system/xbin/ash", "/system/xbin/awk", "/system/xbin/base64", "/system/xbin/basename", "/system/xbin/bbconfig", diff --git a/system.prop b/system.prop index 89d5385f..6244584d 100644 --- a/system.prop +++ b/system.prop @@ -69,10 +69,18 @@ persist.sys.multitouch=2 # Shutter sound enabled persist.sys.camera-mute=0 -# Scrolling cache 0:enable, 1:default enable, 2:default disable, 3:disable -persist.sys.scrollingcache=2 +# Logger properties +persist.service.aplogd.enable=0 + +# max single log file size in MB (default is 10) +aplogd.logfile.size=5 -# enable adbd during first boot (for dalvik cache problems) -persist.service.adb.enable=1 +# single buffers to be collected (0 - disabled) +aplogd.collect.main=1 +aplogd.collect.kernel=1 +aplogd.collect.radio=1 +aplogd.collect.events=0 +# Scrolling cache 0:enable, 1:default enable, 2:default disable, 3:disable +persist.sys.scrollingcache=2