Loading src/com/android/settings/bluetooth/BluetoothDevicePreference.java +12 −4 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.graphics.drawable.Drawable; import android.os.UserManager; import android.text.Html; import android.text.TextUtils; import android.util.Log; import android.util.Pair; import android.util.TypedValue; import android.view.View; Loading @@ -41,13 +42,13 @@ import androidx.preference.PreferenceViewHolder; import com.android.settings.R; import com.android.settings.overlay.FeatureFactory; import com.android.settings.widget.GearPreference; import com.android.settingslib.bluetooth.BluetoothUtils; import com.android.settingslib.bluetooth.CachedBluetoothDevice; import com.android.settingslib.core.instrumentation.MetricsFeatureProvider; import com.android.settingslib.utils.ThreadUtils; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.concurrent.RejectedExecutionException; /** * BluetoothDevicePreference is the preference type used to display each remote Loading Loading @@ -175,6 +176,7 @@ public final class BluetoothDevicePreference extends GearPreference { mHideSecondTarget = hideSecondTarget; } @SuppressWarnings("FutureReturnValueIgnored") void onPreferenceAttributesChanged() { Pair<Drawable, String> pair = mCachedDevice.getDrawableWithDescription(); setIcon(pair.first); Loading @@ -186,9 +188,15 @@ public final class BluetoothDevicePreference extends GearPreference { * any preference info has changed from the previous value. */ setTitle(mCachedDevice.getName()); try { ThreadUtils.postOnBackgroundThread(() -> { String summary = mCachedDevice.getConnectionSummary(); // Null check is done at the framework setSummary(mCachedDevice.getConnectionSummary()); ThreadUtils.postOnMainThread(() -> setSummary(summary)); }); } catch (RejectedExecutionException e) { Log.w(TAG, "Handler thread unavailable, skipping getConnectionSummary!"); } // Used to gray out the item setEnabled(!mCachedDevice.isBusy()); Loading Loading
src/com/android/settings/bluetooth/BluetoothDevicePreference.java +12 −4 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.graphics.drawable.Drawable; import android.os.UserManager; import android.text.Html; import android.text.TextUtils; import android.util.Log; import android.util.Pair; import android.util.TypedValue; import android.view.View; Loading @@ -41,13 +42,13 @@ import androidx.preference.PreferenceViewHolder; import com.android.settings.R; import com.android.settings.overlay.FeatureFactory; import com.android.settings.widget.GearPreference; import com.android.settingslib.bluetooth.BluetoothUtils; import com.android.settingslib.bluetooth.CachedBluetoothDevice; import com.android.settingslib.core.instrumentation.MetricsFeatureProvider; import com.android.settingslib.utils.ThreadUtils; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.concurrent.RejectedExecutionException; /** * BluetoothDevicePreference is the preference type used to display each remote Loading Loading @@ -175,6 +176,7 @@ public final class BluetoothDevicePreference extends GearPreference { mHideSecondTarget = hideSecondTarget; } @SuppressWarnings("FutureReturnValueIgnored") void onPreferenceAttributesChanged() { Pair<Drawable, String> pair = mCachedDevice.getDrawableWithDescription(); setIcon(pair.first); Loading @@ -186,9 +188,15 @@ public final class BluetoothDevicePreference extends GearPreference { * any preference info has changed from the previous value. */ setTitle(mCachedDevice.getName()); try { ThreadUtils.postOnBackgroundThread(() -> { String summary = mCachedDevice.getConnectionSummary(); // Null check is done at the framework setSummary(mCachedDevice.getConnectionSummary()); ThreadUtils.postOnMainThread(() -> setSummary(summary)); }); } catch (RejectedExecutionException e) { Log.w(TAG, "Handler thread unavailable, skipping getConnectionSummary!"); } // Used to gray out the item setEnabled(!mCachedDevice.isBusy()); Loading