Workaround for Android bug when swiped from recent tasks list.

Closes #168

https://code.google.com/p/android/issues/detail?id=53313
This commit is contained in:
Moxie Marlinspike 2014-03-03 11:45:05 -08:00
parent 0f53c9d170
commit b5fe378bc9
3 changed files with 39 additions and 0 deletions

View File

@ -189,6 +189,17 @@
android:windowSoftInputMode="stateHidden"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
<activity android:name=".DummyActivity"
android:theme="@android:style/Theme.NoDisplay"
android:enabled="true"
android:allowTaskReparenting="true"
android:noHistory="true"
android:excludeFromRecents="true"
android:alwaysRetainTaskState="false"
android:stateNotNeeded="true"
android:clearTaskOnLaunch="true"
android:finishOnTaskLaunch="true" />
<service android:enabled="true" android:name=".service.ApplicationMigrationService"/>
<service android:enabled="true" android:name=".service.KeyCachingService"/>
<service android:enabled="true" android:name=".service.SendReceiveService"/>

View File

@ -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();
}
}

View File

@ -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...");