Commit 385e16bd authored by Xing Liu's avatar Xing Liu Committed by Commit Bot

Revert "Download notification: Never call stopForeground without startForeground."

This reverts commit 7da3d4aa.

Reason for revert: This CL doesn't fix the bug, and it's not needed.

Original change's description:
> Download notification: Never call stopForeground without startForeground.
> 
> This CL adds a boolean check for stopForeground that if startForeground
> is not called, then ignore stopForeground call.
> 
> Bug: 1121096
> Change-Id: I71295038925947472b0df7be2630a7cffbb79f97
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2386421
> Reviewed-by: Min Qin <qinmin@chromium.org>
> Commit-Queue: Xing Liu <xingliu@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#803529}

TBR=dtrainor@chromium.org,qinmin@chromium.org,xingliu@chromium.org,qinminusc@gmail.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1121096
Change-Id: I2871266fe482a11f48b21b9bda778444b4f72a7c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2398987Reviewed-by: default avatarXing Liu <xingliu@chromium.org>
Commit-Queue: Xing Liu <xingliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805232}
parent dc3e3256
......@@ -36,10 +36,6 @@ public class DownloadForegroundService extends Service {
private NotificationManager mNotificationManager;
// Whether Service.startForeground is called. Notices Android will crash if
// Service.startForeground is not called when calling Service.stopForeground.
private boolean mStartForeground;
@IntDef({StopForegroundNotification.KILL, StopForegroundNotification.DETACH})
@Retention(RetentionPolicy.SOURCE)
public @interface StopForegroundNotification {
......@@ -235,7 +231,6 @@ public class DownloadForegroundService extends Service {
@VisibleForTesting
void startForegroundInternal(int notificationId, Notification notification) {
Log.w(TAG, "startForegroundInternal id: " + notificationId);
mStartForeground = true;
ForegroundServiceUtils.getInstance().startForeground(
this, notificationId, notification, 0 /* foregroundServiceType */);
}
......@@ -243,10 +238,6 @@ public class DownloadForegroundService extends Service {
@VisibleForTesting
void stopForegroundInternal(int flags) {
Log.w(TAG, "stopForegroundInternal flags: " + flags);
if (!mStartForeground) {
Log.e(TAG, "stopForeground is called without startForeground.");
return;
}
ForegroundServiceUtils.getInstance().stopForeground(this, flags);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment