Merge "Type check before casting from CookieHandler to CookieManager" into oc-dr1-dev