29127a0adc
@Valodim and @dschuermann asked me to do so, and I said yes. #1683
55 lines
1.6 KiB
Java
55 lines
1.6 KiB
Java
/*
|
|
* Copyright (C) 2015-2016 Hans-Christoph Steiner <hans@eds.org>
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
package org.sufficientlysecure.keychain.ui;
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.app.Activity;
|
|
import android.content.Intent;
|
|
import android.os.Build;
|
|
import android.os.Bundle;
|
|
|
|
/**
|
|
* For Guardianproject's PANIC app
|
|
*/
|
|
public class PanicExitActivity extends Activity {
|
|
|
|
@SuppressLint("NewApi")
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
|
|
if (Build.VERSION.SDK_INT >= 21) {
|
|
finishAndRemoveTask();
|
|
} else {
|
|
finish();
|
|
}
|
|
|
|
System.exit(0);
|
|
}
|
|
|
|
public static void exitAndRemoveFromRecentApps(Activity activity) {
|
|
Intent intent = new Intent(activity, PanicExitActivity.class);
|
|
|
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
|
|
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
|
|
| Intent.FLAG_ACTIVITY_CLEAR_TASK
|
|
| Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
|
|
|
activity.startActivity(intent);
|
|
}
|
|
}
|