Clean up Cookie path matching logic.

HttpCookie objects whose path was null wouldn't match any non-null
path. This is incorrect, null paths are equivalent as "/". This case
wasn't caught by our tests it requires a custom CookieManager
implementation that creates "Synthetic" java.net.HttpCookie objects
without any paths set. Cookies that are parsed by the default
CookieManager from response headers always have a non-null path.

This change also makes it so that we send down "$Version=1" only if
all cookies in the list are version 1 cookies. This was the previous
libcore behaviour.

bug: 25763487
bug: 26012446
Change-Id: If53dfd2a8f951a1cc4a3b15775e2d7f8ef61aa05
2 files changed