mobile/android/base/webapp/TaskKiller.java

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:f16cc34e9efb
1 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 package org.mozilla.gecko.webapp;
7
8 import android.content.BroadcastReceiver;
9 import android.content.Context;
10 import android.content.Intent;
11 import android.util.Log;
12
13 /**
14 * This BroadcastReceiver is registered in the AndroidManifest.xml.in file.
15 *
16 * <p>It listens for intents sent by synthesized APKs when the task has been ended.
17 * e.g. when the user has swiped it out of the Recent Apps List.</p>
18 *
19 */
20 public class TaskKiller extends BroadcastReceiver {
21
22 private static final String LOGTAG = "GeckoWebappTaskKiller";
23
24 @Override
25 public void onReceive(Context context, Intent intent) {
26 String packageName = intent.getStringExtra("packageName");
27 int slot = Allocator.getInstance(context).getIndexForApp(packageName);
28 if (slot >= 0) {
29 EventListener.killWebappSlot(context, slot);
30 } else {
31 Log.w(LOGTAG, "Asked to kill " + packageName + " but this runtime (" + context.getPackageName() + ") doesn't know about it.");
32 }
33 }
34
35 }

mercurial