Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/upgrade/PackageReplacedBroadcastReceiver.java

Issue 2778763002: Android: Check intent action in broadcast receiver for package replaced (Closed)
Patch Set: 1 line if Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.upgrade; 5 package org.chromium.chrome.browser.upgrade;
6 6
7 import android.annotation.SuppressLint;
8 import android.content.BroadcastReceiver; 7 import android.content.BroadcastReceiver;
9 import android.content.Context; 8 import android.content.Context;
10 import android.content.Intent; 9 import android.content.Intent;
11 import android.os.Build; 10 import android.os.Build;
12 11
13 /** 12 /**
14 * Triggered when Chrome's package is replaced (e.g. when it is upgraded). 13 * Triggered when Chrome's package is replaced (e.g. when it is upgraded).
15 * 14 *
16 * Before changing this class, you must understand both the Receiver and Process Lifecycles: 15 * Before changing this class, you must understand both the Receiver and Process Lifecycles:
17 * http://developer.android.com/reference/android/content/BroadcastReceiver.html #ReceiverLifecycle 16 * http://developer.android.com/reference/android/content/BroadcastReceiver.html #ReceiverLifecycle
18 * 17 *
19 * - This process runs in the foreground as long as {@link #onReceive} is runnin g. If there are no 18 * - This process runs in the foreground as long as {@link #onReceive} is runnin g. If there are no
20 * other application components running, Android will aggressively kill it. 19 * other application components running, Android will aggressively kill it.
21 * 20 *
22 * - Because this runs in the foreground, don't add any code that could cause ja nk or ANRs. 21 * - Because this runs in the foreground, don't add any code that could cause ja nk or ANRs.
23 * 22 *
24 * - This class immediately cullable by Android as soon as {@link #onReceive} re turns. To kick off 23 * - This class immediately cullable by Android as soon as {@link #onReceive} re turns. To kick off
25 * longer tasks, you must start a Service. 24 * longer tasks, you must start a Service.
26 */ 25 */
27 // TODO(crbug.com/635567): Fix this properly.
28 @SuppressLint("UnsafeProtectedBroadcastReceiver")
29 public final class PackageReplacedBroadcastReceiver extends BroadcastReceiver { 26 public final class PackageReplacedBroadcastReceiver extends BroadcastReceiver {
30 @Override 27 @Override
31 public void onReceive(Context context, Intent intent) { 28 public void onReceive(Context context, Intent intent) {
29 if (!Intent.ACTION_MY_PACKAGE_REPLACED.equals(intent.getAction())) retur n;
32 if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) return; 30 if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) return;
33 UpgradeIntentService.startMigrationIfNecessary(context); 31 UpgradeIntentService.startMigrationIfNecessary(context);
34 } 32 }
35 } 33 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698