diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 713affbf89..f72adb5d6f 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -189,6 +189,17 @@ android:windowSoftInputMode="stateHidden" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/> + + diff --git a/src/org/thoughtcrime/securesms/DummyActivity.java b/src/org/thoughtcrime/securesms/DummyActivity.java new file mode 100644 index 0000000000..bed0d92e38 --- /dev/null +++ b/src/org/thoughtcrime/securesms/DummyActivity.java @@ -0,0 +1,16 @@ +package org.thoughtcrime.securesms; + +import android.app.Activity; +import android.os.Bundle; + +/** + * Workaround for Android bug: + * https://code.google.com/p/android/issues/detail?id=53313 + */ +public class DummyActivity extends Activity { + @Override + public void onCreate(Bundle bundle) { + super.onCreate(bundle); + finish(); + } +} diff --git a/src/org/thoughtcrime/securesms/service/KeyCachingService.java b/src/org/thoughtcrime/securesms/service/KeyCachingService.java index 58e2ffdea8..07388dd4a0 100644 --- a/src/org/thoughtcrime/securesms/service/KeyCachingService.java +++ b/src/org/thoughtcrime/securesms/service/KeyCachingService.java @@ -33,6 +33,7 @@ import android.util.Log; import android.widget.RemoteViews; import org.thoughtcrime.securesms.DatabaseUpgradeActivity; +import org.thoughtcrime.securesms.DummyActivity; import org.thoughtcrime.securesms.R; import org.thoughtcrime.securesms.RoutingActivity; import org.thoughtcrime.securesms.crypto.DecryptingQueue; @@ -133,6 +134,17 @@ public class KeyCachingService extends Service { handleClearKey(); } + /** + * Workaround for Android bug: + * https://code.google.com/p/android/issues/detail?id=53313 + */ + @Override + public void onTaskRemoved(Intent rootIntent) { + Intent intent = new Intent(this, DummyActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + } + private void handleActivityStarted() { Log.w("KeyCachingService", "Incrementing activity count...");