Change RuntimeErrot to OutOfMemoryError

Change-Id: Ic237bc7f0631dcb192be7203379bdf4c5d832b28
main
satok 2010-06-03 23:56:33 +09:00
parent e4c7ad3097
commit dac53d9c7d
5 changed files with 14 additions and 6 deletions

View File

@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.inputmethod.latin" package="com.google.android.inputmethod.latin"
android:versionCode="9" android:versionCode="9"
android:versionName="0.15"> android:versionName="0.16">
<uses-sdk android:minSdkVersion="8"></uses-sdk> <uses-sdk android:minSdkVersion="8"></uses-sdk>

View File

@ -392,7 +392,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
try { try {
mInputView = (LatinKeyboardView) mInputMethodService.getLayoutInflater().inflate( mInputView = (LatinKeyboardView) mInputMethodService.getLayoutInflater().inflate(
LAYOUTS[newLayout], null); LAYOUTS[newLayout], null);
} catch (RuntimeException e) { } catch (OutOfMemoryError e) {
LatinImeLogger.logOnException(mLayoutId + "," + newLayout, e); LatinImeLogger.logOnException(mLayoutId + "," + newLayout, e);
} }
mInputView.setExtentionLayoutResId(LAYOUTS[newLayout]); mInputView.setExtentionLayoutResId(LAYOUTS[newLayout]);

View File

@ -291,7 +291,11 @@ public class LatinIME extends InputMethodService
if (inputLanguage == null) { if (inputLanguage == null) {
inputLanguage = conf.locale.toString(); inputLanguage = conf.locale.toString();
} }
initSuggest(inputLanguage); try {
initSuggest(inputLanguage);
} catch (OutOfMemoryError e) {
LatinImeLogger.logOnException(inputLanguage, e);
}
mOrientation = conf.orientation; mOrientation = conf.orientation;
initSuggestPuncList(); initSuggestPuncList();

View File

@ -550,7 +550,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
} }
} }
public static void logOnException(String metaData, RuntimeException e) { public static void logOnException(String metaData, Throwable e) {
if (sLogEnabled) { if (sLogEnabled) {
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos); PrintStream ps = new PrintStream(baos);
@ -566,7 +566,11 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
sLatinImeLogger.commitInternalAndStopSelf(); sLatinImeLogger.commitInternalAndStopSelf();
} else { } else {
sLatinImeLogger.commitInternal(); sLatinImeLogger.commitInternal();
throw e; if (e instanceof RuntimeException) {
throw (RuntimeException) e;
} else if (e instanceof Error) {
throw (Error) e;
}
} }
} }
} }

View File

@ -474,7 +474,7 @@ public class LatinKeyboardView extends KeyboardView {
public void draw(Canvas c) { public void draw(Canvas c) {
try { try {
super.draw(c); super.draw(c);
} catch (RuntimeException e) { } catch (OutOfMemoryError e) {
LatinImeLogger.logOnException("draw in LatinKeybaordView", e); LatinImeLogger.logOnException("draw in LatinKeybaordView", e);
} }
if (DEBUG_AUTO_PLAY) { if (DEBUG_AUTO_PLAY) {