Revert "Changed ConnectivityService#getServiceInstance so its a singleton." am: 56023ad2c6
Original change: undetermined Change-Id: Ie1a9765cc29732210b8bcd40bc794d215c56b4e9
This commit is contained in:
@@ -105,7 +105,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
private int mNumDnsEntries;
|
private int mNumDnsEntries;
|
||||||
|
|
||||||
private boolean mTestMode;
|
private boolean mTestMode;
|
||||||
private static volatile ConnectivityService sServiceInstance;
|
private static ConnectivityService sServiceInstance;
|
||||||
|
|
||||||
private Handler mHandler;
|
private Handler mHandler;
|
||||||
|
|
||||||
@@ -176,10 +176,11 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
Looper.loop();
|
Looper.loop();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized ConnectivityService getServiceInstance(Context context) {
|
public static ConnectivityService getServiceInstance(Context context) {
|
||||||
if (sServiceInstance == null) {
|
ConnectivityThread thread = new ConnectivityThread(context);
|
||||||
ConnectivityThread thread = new ConnectivityThread(context);
|
thread.start();
|
||||||
thread.start();
|
|
||||||
|
synchronized (thread) {
|
||||||
while (sServiceInstance == null) {
|
while (sServiceInstance == null) {
|
||||||
try {
|
try {
|
||||||
// Wait until sServiceInstance has been initialized.
|
// Wait until sServiceInstance has been initialized.
|
||||||
|
|||||||
Reference in New Issue
Block a user