mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-28 13:40:17 -10:00
Leaving the Fennec process running after a swipe-to-kill puts Fennec in an unrecoverable state; this ensures we kill the process anytime a user swipes-to-kill Fennec and therefore lets us recover as usual.
37 lines
1.1 KiB
Java
37 lines
1.1 KiB
Java
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
package org.mozilla.gecko;
|
|
|
|
import android.app.Service;
|
|
import android.content.Intent;
|
|
import android.os.IBinder;
|
|
import android.os.Process;
|
|
import android.util.Log;
|
|
|
|
public class FennecKiller extends Service {
|
|
private static final String LOGTAG = "GeckoFennecKiller";
|
|
|
|
private static final String BROWSERAPP = "org.mozilla.gecko.BrowserApp";
|
|
|
|
@Override
|
|
public IBinder onBind(Intent intent) {
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public void onTaskRemoved(Intent intent) {
|
|
if (intent != null && intent.getComponent() != null &&
|
|
BROWSERAPP.equals(intent.getComponent().getClassName())) {
|
|
Process.killProcess(Process.myPid());
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
|
return Service.START_NOT_STICKY;
|
|
}
|
|
}
|