Commit 7835b9fa authored by Peter E Conn's avatar Peter E Conn Committed by Commit Bot

🕭 Avoid clearing Task Stack when opening NorificationPreferences.

The Intent to open the Notifications Preferences screen included the
FLAG_ACTIVITY_CLEAR_TASK flag. This means that if the screen were
already present in the Task Stack, the entire stack would be cleared.

This meant that when the user entered Chrome Settings, was linked to
Android Settings (through the Notifications button) and then was
linked back to Chrome Settings (through the "Additional Settings
in the app" link), the whole Task Stack would be cleared. Pressing
Back at this point would take the user to the home screen.

The flag was originally set to prevent instability due to having
Callbacks destined for the first Settings Activity arriving at the
second Settings Activity and generally making a mess of things.

I'm disabling the flag in the hope such instability has been fixed,
and if not to generate some up to date crash reports.

Bug: 803422, 707804
Change-Id: Id662fd7218e35739755e97fb42780ebd16b09346
Reviewed-on: https://chromium-review.googlesource.com/886844
Commit-Queue: Peter Conn <peconn@chromium.org>
Reviewed-by: default avatarBernhard Bauer <bauerb@chromium.org>
Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531933}
parent b28cfe37
......@@ -290,10 +290,6 @@ public class NotificationPlatformBridge {
}
preferencesIntent.putExtra(Preferences.EXTRA_SHOW_FRAGMENT_ARGUMENTS, fragmentArguments);
// We need to ensure that no existing preference tasks are being re-used in order for the
// new activity to appear on top.
preferencesIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
applicationContext.startActivity(preferencesIntent);
}
......
......@@ -10,6 +10,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.provider.Settings;
import org.chromium.base.BuildInfo;
import org.chromium.base.VisibleForTesting;
......@@ -100,10 +101,9 @@ public class MainPreferences extends PreferenceFragment
// Settings notifications page, not to Chrome's notifications settings page.
Preference notifications = findPreference(PREF_NOTIFICATIONS);
notifications.setOnPreferenceClickListener(preference -> {
// TODO(crbug.com/707804): Use Android O constants.
Intent intent = new Intent();
intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
intent.putExtra("android.provider.extra.APP_PACKAGE", BuildInfo.getPackageName());
intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
intent.putExtra(Settings.EXTRA_APP_PACKAGE, BuildInfo.getPackageName());
startActivity(intent);
// We handle the click so the default action (opening NotificationsPreference)
// isn't triggered.
......
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