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