mobile/android/base/webapp/TaskKiller.java

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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/. */
     6 package org.mozilla.gecko.webapp;
     8 import android.content.BroadcastReceiver;
     9 import android.content.Context;
    10 import android.content.Intent;
    11 import android.util.Log;
    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 {
    22     private static final String LOGTAG = "GeckoWebappTaskKiller";
    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     }
    35 }

mercurial