Loading packages/CompanionDeviceManager/src/com/android/companiondevicemanager/DeviceDiscoveryService.java +8 −5 Original line number Original line Diff line number Diff line Loading @@ -65,9 +65,7 @@ import android.widget.TextView; import com.android.internal.util.ArrayUtils; import com.android.internal.util.ArrayUtils; import com.android.internal.util.CollectionUtils; import com.android.internal.util.CollectionUtils; import com.android.internal.util.Preconditions; import com.android.internal.util.Preconditions; import com.android.internal.util.function.pooled.PooledLambda; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.ArrayList; import java.util.List; import java.util.List; import java.util.Objects; import java.util.Objects; Loading Loading @@ -219,7 +217,7 @@ public class DeviceDiscoveryService extends Service { stopScan(); stopScan(); mDevicesFound.clear(); mDevicesFound.clear(); mSelectedDevice = null; mSelectedDevice = null; mDevicesAdapter.notifyDataSetChanged(); notifyDataSetChanged(); } } @Override @Override Loading Loading @@ -265,7 +263,12 @@ public class DeviceDiscoveryService extends Service { onReadyToShowUI(); onReadyToShowUI(); } } mDevicesFound.add(device); mDevicesFound.add(device); mDevicesAdapter.notifyDataSetChanged(); notifyDataSetChanged(); } private void notifyDataSetChanged() { Handler.getMain().sendMessage(obtainMessage( DevicesAdapter::notifyDataSetChanged, mDevicesAdapter)); } } //TODO also, on timeout -> call onFailure //TODO also, on timeout -> call onFailure Loading @@ -283,7 +286,7 @@ public class DeviceDiscoveryService extends Service { private void onDeviceLost(@Nullable DeviceFilterPair device) { private void onDeviceLost(@Nullable DeviceFilterPair device) { mDevicesFound.remove(device); mDevicesFound.remove(device); mDevicesAdapter.notifyDataSetChanged(); notifyDataSetChanged(); if (DEBUG) Log.i(LOG_TAG, "Lost device " + device.getDisplayName()); if (DEBUG) Log.i(LOG_TAG, "Lost device " + device.getDisplayName()); } } Loading Loading
packages/CompanionDeviceManager/src/com/android/companiondevicemanager/DeviceDiscoveryService.java +8 −5 Original line number Original line Diff line number Diff line Loading @@ -65,9 +65,7 @@ import android.widget.TextView; import com.android.internal.util.ArrayUtils; import com.android.internal.util.ArrayUtils; import com.android.internal.util.CollectionUtils; import com.android.internal.util.CollectionUtils; import com.android.internal.util.Preconditions; import com.android.internal.util.Preconditions; import com.android.internal.util.function.pooled.PooledLambda; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.ArrayList; import java.util.List; import java.util.List; import java.util.Objects; import java.util.Objects; Loading Loading @@ -219,7 +217,7 @@ public class DeviceDiscoveryService extends Service { stopScan(); stopScan(); mDevicesFound.clear(); mDevicesFound.clear(); mSelectedDevice = null; mSelectedDevice = null; mDevicesAdapter.notifyDataSetChanged(); notifyDataSetChanged(); } } @Override @Override Loading Loading @@ -265,7 +263,12 @@ public class DeviceDiscoveryService extends Service { onReadyToShowUI(); onReadyToShowUI(); } } mDevicesFound.add(device); mDevicesFound.add(device); mDevicesAdapter.notifyDataSetChanged(); notifyDataSetChanged(); } private void notifyDataSetChanged() { Handler.getMain().sendMessage(obtainMessage( DevicesAdapter::notifyDataSetChanged, mDevicesAdapter)); } } //TODO also, on timeout -> call onFailure //TODO also, on timeout -> call onFailure Loading @@ -283,7 +286,7 @@ public class DeviceDiscoveryService extends Service { private void onDeviceLost(@Nullable DeviceFilterPair device) { private void onDeviceLost(@Nullable DeviceFilterPair device) { mDevicesFound.remove(device); mDevicesFound.remove(device); mDevicesAdapter.notifyDataSetChanged(); notifyDataSetChanged(); if (DEBUG) Log.i(LOG_TAG, "Lost device " + device.getDisplayName()); if (DEBUG) Log.i(LOG_TAG, "Lost device " + device.getDisplayName()); } } Loading