Fix the issue that SettingsProvider sees mismatched calling uid and pkg

From SettingsProvider point of view, the calling package is "android".
However, the callingUID is the client that calls into TCMS.
The solution is to clear the calling identity when accessing
DeviceConfig in a binder call.

The problem is intermittent is because TCMS also accesses
DeviceConfig in its constructor. It is not in a binder call, and thus
it works. DeviceConfig caches the value, and so subsequent DeviceConfig
calls won't actually call into SettingsProvider, not until the cache
is invalidated somehow.
I can reproduce the issue all the time by commenting the line that
accesses DeviceConfig in the constructor.

BUG: 149219961

Test: Comment the line that accesses DeviceConfig in the constructor.
      And try out smart selection and smart reply.

Change-Id: I6d27bf9b5ec0d4337c2623a83d326adc688269af
1 file changed