Revert "Changed ConnectivityService#getServiceInstance so its a singleton."
This reverts commit 7323ea10cd which causes this exception:
E/SystemServer( 2653): Failure starting Connectivity Service
E/SystemServer( 2653): java.lang.IllegalMonitorStateException: object not locked by thread before wait()
E/SystemServer( 2653): at java.lang.Object.wait(Native Method)
E/SystemServer( 2653): at java.lang.Object.wait(Object.java:358)
E/SystemServer( 2653): at com.android.server.ConnectivityService$ConnectivityThread.getServiceInstance(ConnectivityService.java:186)
E/SystemServer( 2653): at com.android.server.ConnectivityService.getInstance(ConnectivityService.java:200)
E/SystemServer( 2653): at com.android.server.ServerThread.run(SystemServer.java:262)
Change-Id: Idd139e426e61a1913b0bf343e2f0a0b1990ba8bb
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