Add error reason for OutOfMemoryError and make importer use it.
Change-Id: I4c61740c3bebae82cc180c6374c41fcc603e33cf
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 81abb78..634e65d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -708,6 +708,10 @@
emitted some I/O error. Exact reason will be appended by the system. -->
<string name="fail_reason_io_error">I/O Error</string>
+ <!-- Failure reason show when Contacts app (especially vCard importer) encountered
+ low memory problem and could not proceed its import procedure. -->
+ <string name="fail_reason_low_memory_during_import">Memory is insufficient (the file may be too large)</string>
+
<!-- The failed reason shown when vCard parser was not able to be parsed by the current vCard
implementation. This might happen even when the input vCard is completely valid, though
we believe it is rather rare in the actual world. -->
diff --git a/src/com/android/contacts/ImportVCardActivity.java b/src/com/android/contacts/ImportVCardActivity.java
index ade0fdb..84d481b 100644
--- a/src/com/android/contacts/ImportVCardActivity.java
+++ b/src/com/android/contacts/ImportVCardActivity.java
@@ -340,15 +340,13 @@
needFinish = false;
unbindService(mConnection);
runOnUIThread(new DialogDisplayer(
- getString(R.string.fail_reason_io_error) +
- ": " + e.getLocalizedMessage()));
+ getString(R.string.fail_reason_low_memory_during_import)));
} catch (IOException e) {
Log.e(LOG_TAG, e.getMessage());
needFinish = false;
unbindService(mConnection);
runOnUIThread(new DialogDisplayer(
- getString(R.string.fail_reason_io_error) +
- ": " + e.getLocalizedMessage()));
+ getString(R.string.fail_reason_io_error)));
} finally {
mWakeLock.release();
mProgressDialogForCacheVCard.dismiss();