Commit 176ec0a2 authored by Xing Liu's avatar Xing Liu Committed by Commit Bot

Sync: Polish notification title on Android N+.

Starts from Android N, notification by default has the app name, so the
title should not be same as the app name. The title can be "Sync", and
the text can be updated from "Sync: {sync message}" to "{sync message}".

Bug: 875906
Change-Id: Ifee2bca85305ad9ae62b6122bec9bbf83d59f026
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1829740Reviewed-by: default avatarTommy Nyquist <nyquist@chromium.org>
Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Commit-Queue: Xing Liu <xingliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701227}
parent ccce9725
...@@ -6,6 +6,7 @@ package org.chromium.chrome.browser.sync; ...@@ -6,6 +6,7 @@ package org.chromium.chrome.browser.sync;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Build;
import android.util.Log; import android.util.Log;
import org.chromium.base.ContextUtils; import org.chromium.base.ContextUtils;
...@@ -90,9 +91,17 @@ public class SyncNotificationController implements ProfileSyncService.SyncStateC ...@@ -90,9 +91,17 @@ public class SyncNotificationController implements ProfileSyncService.SyncStateC
*/ */
private void showSyncNotification(int message, Intent intent) { private void showSyncNotification(int message, Intent intent) {
Context applicationContext = ContextUtils.getApplicationContext(); Context applicationContext = ContextUtils.getApplicationContext();
String title = applicationContext.getString(R.string.app_name); String title = null, text = null;
String text = applicationContext.getString(R.string.sign_in_sync) + ": " // From Android N, notification by default has the app name and title should not be the same
+ applicationContext.getString(message); // as app name.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
title = applicationContext.getString(R.string.sign_in_sync);
text = applicationContext.getString(message);
} else {
title = applicationContext.getString(R.string.app_name);
text = applicationContext.getString(R.string.sign_in_sync) + ": "
+ applicationContext.getString(message);
}
PendingIntentProvider contentIntent = PendingIntentProvider contentIntent =
PendingIntentProvider.getActivity(applicationContext, 0, intent, 0); PendingIntentProvider.getActivity(applicationContext, 0, intent, 0);
......
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