Merge "Fix usage of the updated CDM APIs"

This commit is contained in:
Sergey Nikolaienkov
2021-11-26 06:38:03 +00:00
committed by Android (Google) Code Review
4 changed files with 37 additions and 17 deletions

View File

@@ -29,6 +29,7 @@ import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.provider.DeviceConfig;
import android.text.TextUtils;
import android.util.Log;
@@ -126,8 +127,8 @@ public class BluetoothDetailsCompanionAppsController extends BluetoothDetailsCon
try {
java.util.Objects.requireNonNull(ICompanionDeviceManager.Stub.asInterface(
ServiceManager.getService(
Context.COMPANION_DEVICE_SERVICE))).disassociate(
address, packageName);
Context.COMPANION_DEVICE_SERVICE))).legacyDisassociate(
address, packageName, UserHandle.myUserId());
} catch (RemoteException e) {
throw new RuntimeException(e);
}

View File

@@ -54,6 +54,7 @@ import android.util.Log;
import androidx.annotation.VisibleForTesting;
import com.android.internal.util.CollectionUtils;
import com.android.settingslib.R;
import com.android.settingslib.Utils;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
@@ -159,7 +160,9 @@ public class NotificationBackend {
StringBuilder sb = new StringBuilder();
try {
List<String> associatedMacAddrs = cdm.getAssociations(pkg, userId);
List<String> associatedMacAddrs = CollectionUtils.mapNotNull(
cdm.getAssociations(pkg, userId),
a -> a.isSelfManaged() ? null : a.getDeviceMacAddress().toString());
if (associatedMacAddrs != null) {
for (String assocMac : associatedMacAddrs) {
final Collection<CachedBluetoothDevice> cachedDevices =