Loading packages/SettingsLib/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ android_library { "androidx.localbroadcastmanager_localbroadcastmanager", "androidx.room_room-runtime", "zxing-core", "guava", "WifiTrackerLibRes", "iconloader", Loading packages/SettingsLib/src/com/android/settingslib/applications/AppUtils.java +1 −1 Original line number Diff line number Diff line Loading @@ -281,7 +281,7 @@ public class AppUtils { for (int i = 0; i < Math.min(appEntries.size(), number); i++) { final ApplicationsState.AppEntry entry = appEntries.get(i); ThreadUtils.postOnBackgroundThread(() -> { var unused = ThreadUtils.getBackgroundExecutor().submit(() -> { getIcon(context, entry); }); } Loading packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java +1 −1 Original line number Diff line number Diff line Loading @@ -1679,7 +1679,7 @@ public class ApplicationsState { ensureLabel(context); // Speed up the cache of the label description if they haven't been created. if (this.labelDescription == null) { ThreadUtils.postOnBackgroundThread( var unused = ThreadUtils.getBackgroundExecutor().submit( () -> this.ensureLabelDescriptionLocked(context)); } UserManager um = UserManager.get(context); Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +15 −5 Original line number Diff line number Diff line Loading @@ -49,6 +49,10 @@ import com.android.settingslib.Utils; import com.android.settingslib.utils.ThreadUtils; import com.android.settingslib.widget.AdaptiveOutlineDrawable; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Collection; Loading Loading @@ -708,7 +712,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> void refresh() { ThreadUtils.postOnBackgroundThread(() -> { ListenableFuture<Void> future = ThreadUtils.getBackgroundExecutor().submit(() -> { if (BluetoothUtils.isAdvancedDetailsHeader(mDevice)) { Uri uri = BluetoothUtils.getUriMetaData(getDevice(), BluetoothDevice.METADATA_MAIN_ICON); Loading @@ -718,11 +722,17 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> mContext, this).first); } } ThreadUtils.postOnMainThread(() -> { dispatchAttributesChanged(); }); return null; }); Futures.addCallback(future, new FutureCallback<>() { @Override public void onSuccess(Void result) { dispatchAttributesChanged(); } @Override public void onFailure(Throwable t) {} }, mContext.getMainExecutor()); } public void setJustDiscovered(boolean justDiscovered) { Loading packages/SettingsLib/src/com/android/settingslib/deviceinfo/AbstractBluetoothAddressPreferenceController.java +15 −5 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.bluetooth.BluetoothAdapter; import android.content.Context; import android.text.TextUtils; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; Loading @@ -29,6 +30,10 @@ import com.android.settingslib.R; import com.android.settingslib.core.lifecycle.Lifecycle; import com.android.settingslib.utils.ThreadUtils; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; /** * Preference controller for bluetooth address */ Loading Loading @@ -75,9 +80,11 @@ public abstract class AbstractBluetoothAddressPreferenceController protected void updateConnectivity() { BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter(); if (bluetooth != null && mBtAddress != null) { ThreadUtils.postOnBackgroundThread(() -> { String address = bluetooth.isEnabled() ? bluetooth.getAddress() : null; ThreadUtils.postOnMainThread(() -> { ListenableFuture<String> future = ThreadUtils.getBackgroundExecutor() .submit(() -> bluetooth.isEnabled() ? bluetooth.getAddress() : null); Futures.addCallback(future, new FutureCallback<>() { @Override public void onSuccess(@Nullable String address) { if (!TextUtils.isEmpty(address)) { // Convert the address to lowercase for consistency with the wifi MAC // address. Loading @@ -85,8 +92,11 @@ public abstract class AbstractBluetoothAddressPreferenceController } else { mBtAddress.setSummary(R.string.status_unavailable); } }); }); } @Override public void onFailure(Throwable t) {} }, mContext.getMainExecutor()); } } } Loading
packages/SettingsLib/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ android_library { "androidx.localbroadcastmanager_localbroadcastmanager", "androidx.room_room-runtime", "zxing-core", "guava", "WifiTrackerLibRes", "iconloader", Loading
packages/SettingsLib/src/com/android/settingslib/applications/AppUtils.java +1 −1 Original line number Diff line number Diff line Loading @@ -281,7 +281,7 @@ public class AppUtils { for (int i = 0; i < Math.min(appEntries.size(), number); i++) { final ApplicationsState.AppEntry entry = appEntries.get(i); ThreadUtils.postOnBackgroundThread(() -> { var unused = ThreadUtils.getBackgroundExecutor().submit(() -> { getIcon(context, entry); }); } Loading
packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java +1 −1 Original line number Diff line number Diff line Loading @@ -1679,7 +1679,7 @@ public class ApplicationsState { ensureLabel(context); // Speed up the cache of the label description if they haven't been created. if (this.labelDescription == null) { ThreadUtils.postOnBackgroundThread( var unused = ThreadUtils.getBackgroundExecutor().submit( () -> this.ensureLabelDescriptionLocked(context)); } UserManager um = UserManager.get(context); Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +15 −5 Original line number Diff line number Diff line Loading @@ -49,6 +49,10 @@ import com.android.settingslib.Utils; import com.android.settingslib.utils.ThreadUtils; import com.android.settingslib.widget.AdaptiveOutlineDrawable; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Collection; Loading Loading @@ -708,7 +712,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> void refresh() { ThreadUtils.postOnBackgroundThread(() -> { ListenableFuture<Void> future = ThreadUtils.getBackgroundExecutor().submit(() -> { if (BluetoothUtils.isAdvancedDetailsHeader(mDevice)) { Uri uri = BluetoothUtils.getUriMetaData(getDevice(), BluetoothDevice.METADATA_MAIN_ICON); Loading @@ -718,11 +722,17 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> mContext, this).first); } } ThreadUtils.postOnMainThread(() -> { dispatchAttributesChanged(); }); return null; }); Futures.addCallback(future, new FutureCallback<>() { @Override public void onSuccess(Void result) { dispatchAttributesChanged(); } @Override public void onFailure(Throwable t) {} }, mContext.getMainExecutor()); } public void setJustDiscovered(boolean justDiscovered) { Loading
packages/SettingsLib/src/com/android/settingslib/deviceinfo/AbstractBluetoothAddressPreferenceController.java +15 −5 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.bluetooth.BluetoothAdapter; import android.content.Context; import android.text.TextUtils; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import androidx.preference.Preference; import androidx.preference.PreferenceScreen; Loading @@ -29,6 +30,10 @@ import com.android.settingslib.R; import com.android.settingslib.core.lifecycle.Lifecycle; import com.android.settingslib.utils.ThreadUtils; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; /** * Preference controller for bluetooth address */ Loading Loading @@ -75,9 +80,11 @@ public abstract class AbstractBluetoothAddressPreferenceController protected void updateConnectivity() { BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter(); if (bluetooth != null && mBtAddress != null) { ThreadUtils.postOnBackgroundThread(() -> { String address = bluetooth.isEnabled() ? bluetooth.getAddress() : null; ThreadUtils.postOnMainThread(() -> { ListenableFuture<String> future = ThreadUtils.getBackgroundExecutor() .submit(() -> bluetooth.isEnabled() ? bluetooth.getAddress() : null); Futures.addCallback(future, new FutureCallback<>() { @Override public void onSuccess(@Nullable String address) { if (!TextUtils.isEmpty(address)) { // Convert the address to lowercase for consistency with the wifi MAC // address. Loading @@ -85,8 +92,11 @@ public abstract class AbstractBluetoothAddressPreferenceController } else { mBtAddress.setSummary(R.string.status_unavailable); } }); }); } @Override public void onFailure(Throwable t) {} }, mContext.getMainExecutor()); } } }