Bug 1167394 - Tab Queue should ignore Sync notifications r=mcomella

This commit is contained in:
Martyn Haigh 2015-07-02 10:07:04 +01:00
parent 2e5864440f
commit a197dec629
2 changed files with 10 additions and 0 deletions

View File

@ -18,6 +18,7 @@ import org.mozilla.gecko.background.common.log.Logger;
import org.mozilla.gecko.sync.repositories.NullCursorException;
import org.mozilla.gecko.sync.repositories.android.ClientsDatabaseAccessor;
import org.mozilla.gecko.sync.repositories.domain.ClientRecord;
import org.mozilla.gecko.tabqueue.TabQueueDispatcher;
import android.app.Notification;
import android.app.NotificationManager;
@ -278,6 +279,7 @@ public class CommandProcessor {
// Set pending intent associated with the notification.
Intent notificationIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
notificationIntent.putExtra(TabQueueDispatcher.SKIP_TAB_QUEUE_FLAG, true);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, notificationTitle, uri, contentIntent);

View File

@ -27,6 +27,7 @@ import android.util.Log;
*/
public class TabQueueDispatcher extends Locales.LocaleAwareActivity {
private static final String LOGTAG = "Gecko" + TabQueueDispatcher.class.getSimpleName();
public static final String SKIP_TAB_QUEUE_FLAG = "skip_tab_queue";
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -50,6 +51,13 @@ public class TabQueueDispatcher extends Locales.LocaleAwareActivity {
return;
}
// Skip the Tab Queue if instructed.
boolean shouldSkipTabQueue = safeIntent.getBooleanExtra(SKIP_TAB_QUEUE_FLAG, false);
if (shouldSkipTabQueue) {
loadNormally(safeIntent.getUnsafe());
return;
}
// The URL is usually hiding somewhere in the extra text. Extract it.
final String dataString = safeIntent.getDataString();
if (TextUtils.isEmpty(dataString)) {