Make compile functions return by value

This CL makes compileFromCache and compileModelAndCache return an error
code and model by value. Additionally, it abstracts both functions in a
generic call to "compile" that also returns by value.

Bug: N/A
Test: mma
Test: NeuralNetworksTest_static
Test: CtsNNAPITestCases
Change-Id: I22a240745e4d9b5e4063950ee5272b45b4db2893
Merged-In: I22a240745e4d9b5e4063950ee5272b45b4db2893
(cherry picked from commit 25dcabc541eecbb7f8b913a36fec28caec6cb150)
2 files changed