mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-28 13:40:17 -10:00
This simple Service needed to be migrated to JobIntentService because it could be started from background and we don't want it as a foreground service (with a notification). (For example: when the app is updated org.mozilla.gecko.PackageReplacedReceiver would try and start this service. If in background, the app would crash) Had to break the initial Service into separate JobIntentServices because in the event that there are concurrent calls (even with different Intent actions) JobScheduler would assume they are for the same already running service. INTENT_ACTION_UPDATE_ADDONS was removed as it was being unused. MozReview-Commit-ID: 2GiWFZdAVvp
31 lines
1.1 KiB
Java
31 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.content.BroadcastReceiver;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.util.Log;
|
|
|
|
/**
|
|
* This broadcast receiver receives ACTION_MY_PACKAGE_REPLACED broadcasts and
|
|
* starts procedures that should run after the APK has been updated.
|
|
*/
|
|
public class PackageReplacedReceiver extends BroadcastReceiver {
|
|
public static final String ACTION_MY_PACKAGE_REPLACED = "android.intent.action.MY_PACKAGE_REPLACED";
|
|
|
|
@Override
|
|
public void onReceive(Context context, Intent intent) {
|
|
if (intent == null || !ACTION_MY_PACKAGE_REPLACED.equals(intent.getAction())) {
|
|
// This is not the broadcast we are looking for.
|
|
return;
|
|
}
|
|
|
|
// Load new Gecko libs to extract them to cache.
|
|
GeckoLoadLibsService.enqueueWork(context, GeckoService.getIntentToLoadLibs());
|
|
}
|
|
}
|