Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09c8b0da authored by Haijie Hong's avatar Haijie Hong Committed by Android (Google) Code Review
Browse files

Merge "Add method to get bluetooth key missing count" into main

parents 1c413e4d 96910f7d
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -51,6 +51,8 @@ import com.android.settingslib.widget.AdaptiveOutlineDrawable;
import com.google.common.collect.ImmutableSet;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
@@ -1268,4 +1270,15 @@ public class BluetoothUtils {

        return false;
    }

    /** Gets key missing count of the device. This is a workaround before the API is rolled out. */
    public static Integer getKeyMissingCount(BluetoothDevice device) {
        try {
            Method m = BluetoothDevice.class.getDeclaredMethod("getKeyMissingCount");
            return (int) m.invoke(device);
        } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
            Log.w(TAG, "error happens when getKeyMissingCount.");
            return null;
        }
    }
}