Bug: 116329414 Bug: 119867234 Test: new unit tests Change-Id: I92a3f4f95e5f482f6fe20f17ed83c8ed367b06dc