Run LowpanManager on BackgroundThread

The ConnectivityThread class is being separated into a specific
connectivity JAR; transport-specific managers like LowpanManager should
not be sharing the ConnectivityThread.

As callbacks from ILowpanManager / ILowpanManagerListener already do not
have any ordering guarantee with ConnectivityManager callbacks, the
impact of this change should be minimal.

LowpanManager is unused in AOSP, and not part of the API.

Bug: 174436414
Test: m
Change-Id: I23483ed7c4a6c5283b365430a3e503a0dd86c2cb
This commit is contained in:
Remi NGUYEN VAN
2020-12-02 13:37:51 +09:00
parent 294dd8f1da
commit cad9420134
2 changed files with 10 additions and 4 deletions

View File

@@ -113,7 +113,6 @@ import android.media.tv.tunerresourcemanager.ITunerResourceManager;
import android.media.tv.tunerresourcemanager.TunerResourceManager;
import android.net.ConnectivityDiagnosticsManager;
import android.net.ConnectivityManager;
import android.net.ConnectivityThread;
import android.net.EthernetManager;
import android.net.IConnectivityManager;
import android.net.IEthernetManager;
@@ -768,8 +767,7 @@ public final class SystemServiceRegistry {
public LowpanManager createService(ContextImpl ctx) throws ServiceNotFoundException {
IBinder b = ServiceManager.getServiceOrThrow(Context.LOWPAN_SERVICE);
ILowpanManager service = ILowpanManager.Stub.asInterface(b);
return new LowpanManager(ctx.getOuterContext(), service,
ConnectivityThread.getInstanceLooper());
return new LowpanManager(ctx.getOuterContext(), service);
}});
registerService(Context.ETHERNET_SERVICE, EthernetManager.class,

View File

@@ -24,6 +24,10 @@ import android.os.IBinder;
import android.os.Looper;
import android.os.RemoteException;
import android.os.ServiceManager;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.os.BackgroundThread;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Map;
@@ -97,10 +101,14 @@ public class LowpanManager {
*
* @param context the application context
* @param service the Binder interface
* @param looper the default Looper to run callbacks on
* @hide - hide this because it takes in a parameter of type ILowpanManager, which is a system
* private class.
*/
public LowpanManager(Context context, ILowpanManager service) {
this(context, service, BackgroundThread.get().getLooper());
}
@VisibleForTesting
public LowpanManager(Context context, ILowpanManager service, Looper looper) {
mContext = context;
mService = service;