OSDN Git Service

Fix: ConnectivityManager is initialized with a wrong context
authorChalard Jean <jchalard@google.com>
Tue, 15 May 2018 14:11:45 +0000 (23:11 +0900)
committerChalard Jean <jchalard@google.com>
Tue, 15 May 2018 14:18:05 +0000 (23:18 +0900)
commit100df0a66c28bfae8f4e3c2dd6c4c7b21294456d
tree8c3fd35f25b98159684ad206d57c71a2056c17be
parent47a8ecce90716d534781e2e39e0a44c03cc422e0
Fix: ConnectivityManager is initialized with a wrong context

ActivityThread#setHttpProxy uses a system context to get
a ConnectivityManager instance. If it's not already cached, the
system service registry will cache this instance initialized
with the system context, and subsequent calls to get this service
will return the bad instance.
This patch uses the application context instead, unless it's
not available for some unlikely reason.

A possible symptom of this issue is to have Bluetooth tethering
failing with a security exception, because it's requested by
the "android" package without system uid.

Bug: 73572062
Test: manual
Change-Id: I745707e4ffe564f6d201ec259fa6b5ee32fbeda6
core/java/android/app/ActivityThread.java