Merge change 21298 into eclair
* changes: ConnectivityService: Do not send broadcasts until the system is ready.
This commit is contained in:
@@ -100,6 +100,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
// a process dies
|
// a process dies
|
||||||
private List mFeatureUsers;
|
private List mFeatureUsers;
|
||||||
|
|
||||||
|
private boolean mSystemReady;
|
||||||
|
private ArrayList<Intent> mDeferredBroadcasts;
|
||||||
|
|
||||||
private class NetworkAttributes {
|
private class NetworkAttributes {
|
||||||
/**
|
/**
|
||||||
* Class for holding settings read from resources.
|
* Class for holding settings read from resources.
|
||||||
@@ -820,7 +823,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
(newNet == null || !newNet.isAvailable() ? "" : " other=" +
|
(newNet == null || !newNet.isAvailable() ? "" : " other=" +
|
||||||
newNet.getNetworkInfo().getTypeName()));
|
newNet.getNetworkInfo().getTypeName()));
|
||||||
|
|
||||||
mContext.sendStickyBroadcast(intent);
|
sendStickyBroadcast(intent);
|
||||||
/*
|
/*
|
||||||
* If the failover network is already connected, then immediately send
|
* If the failover network is already connected, then immediately send
|
||||||
* out a followup broadcast indicating successful failover
|
* out a followup broadcast indicating successful failover
|
||||||
@@ -843,7 +846,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
intent.putExtra(ConnectivityManager.EXTRA_EXTRA_INFO,
|
intent.putExtra(ConnectivityManager.EXTRA_EXTRA_INFO,
|
||||||
info.getExtraInfo());
|
info.getExtraInfo());
|
||||||
}
|
}
|
||||||
mContext.sendStickyBroadcast(intent);
|
sendStickyBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -882,7 +885,33 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
intent.putExtra(ConnectivityManager.EXTRA_IS_FAILOVER, true);
|
intent.putExtra(ConnectivityManager.EXTRA_IS_FAILOVER, true);
|
||||||
info.setFailover(false);
|
info.setFailover(false);
|
||||||
}
|
}
|
||||||
mContext.sendStickyBroadcast(intent);
|
sendStickyBroadcast(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendStickyBroadcast(Intent intent) {
|
||||||
|
synchronized(this) {
|
||||||
|
if (mSystemReady) {
|
||||||
|
mContext.sendStickyBroadcast(intent);
|
||||||
|
} else {
|
||||||
|
if (mDeferredBroadcasts == null) {
|
||||||
|
mDeferredBroadcasts = new ArrayList<Intent>();
|
||||||
|
}
|
||||||
|
mDeferredBroadcasts.add(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void systemReady() {
|
||||||
|
synchronized(this) {
|
||||||
|
mSystemReady = true;
|
||||||
|
if (mDeferredBroadcasts != null) {
|
||||||
|
int count = mDeferredBroadcasts.size();
|
||||||
|
for (int i = 0; i < count; i++) {
|
||||||
|
mContext.sendStickyBroadcast(mDeferredBroadcasts.get(i));
|
||||||
|
}
|
||||||
|
mDeferredBroadcasts = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleConnect(NetworkInfo info) {
|
private void handleConnect(NetworkInfo info) {
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ class ServerThread extends Thread {
|
|||||||
HardwareService hardware = null;
|
HardwareService hardware = null;
|
||||||
PowerManagerService power = null;
|
PowerManagerService power = null;
|
||||||
BatteryService battery = null;
|
BatteryService battery = null;
|
||||||
|
ConnectivityService connectivity = null;
|
||||||
IPackageManager pm = null;
|
IPackageManager pm = null;
|
||||||
Context context = null;
|
Context context = null;
|
||||||
WindowManagerService wm = null;
|
WindowManagerService wm = null;
|
||||||
@@ -231,8 +232,8 @@ class ServerThread extends Thread {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Log.i(TAG, "Starting Connectivity Service.");
|
Log.i(TAG, "Starting Connectivity Service.");
|
||||||
ServiceManager.addService(Context.CONNECTIVITY_SERVICE,
|
connectivity = ConnectivityService.getInstance(context);
|
||||||
ConnectivityService.getInstance(context));
|
ServiceManager.addService(Context.CONNECTIVITY_SERVICE, connectivity);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.e(TAG, "Failure starting Connectivity Service", e);
|
Log.e(TAG, "Failure starting Connectivity Service", e);
|
||||||
}
|
}
|
||||||
@@ -384,7 +385,8 @@ class ServerThread extends Thread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (wallpaper != null) wallpaper.systemReady();
|
if (wallpaper != null) wallpaper.systemReady();
|
||||||
battery.systemReady();
|
if (battery != null) battery.systemReady();
|
||||||
|
if (connectivity != null) connectivity.systemReady();
|
||||||
Watchdog.getInstance().start();
|
Watchdog.getInstance().start();
|
||||||
|
|
||||||
Looper.loop();
|
Looper.loop();
|
||||||
|
|||||||
Reference in New Issue
Block a user