Loading packages/SettingsLib/src/com/android/settingslib/media/LocalMediaManager.java +16 −1 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ import java.util.concurrent.CopyOnWriteArrayList; public class LocalMediaManager implements BluetoothCallback { private static final String TAG = "LocalMediaManager"; private static final int MAX_DISCONNECTED_DEVICE_NUM = 5; private static final int MIN_DURATION_BETWEEN_SUGGESTION_REQUESTS_MILLIS = 5000; @Retention(RetentionPolicy.SOURCE) @IntDef({MediaDeviceState.STATE_CONNECTED, Loading Loading @@ -112,6 +113,8 @@ public class LocalMediaManager implements BluetoothCallback { @VisibleForTesting BluetoothAdapter mBluetoothAdapter; private long mLastSuggestionRequestTime = 0L; /** * Register to start receiving callbacks for MediaDevice events. */ Loading Loading @@ -246,7 +249,19 @@ public class LocalMediaManager implements BluetoothCallback { /** Requests a suggestion from other routers. */ public void requestDeviceSuggestion() { // Debounce multiple requests in a short duration long currentRequestTime = System.currentTimeMillis(); if (currentRequestTime - mLastSuggestionRequestTime > MIN_DURATION_BETWEEN_SUGGESTION_REQUESTS_MILLIS) { Log.d(TAG, "requesting device suggestion"); mLastSuggestionRequestTime = currentRequestTime; mInfoMediaManager.requestDeviceSuggestion(); } else { Log.d( TAG, "requestDeviceSuggestion() ignored due to difference between requests: " + (currentRequestTime - mLastSuggestionRequestTime)); } } @Nullable Loading Loading
packages/SettingsLib/src/com/android/settingslib/media/LocalMediaManager.java +16 −1 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ import java.util.concurrent.CopyOnWriteArrayList; public class LocalMediaManager implements BluetoothCallback { private static final String TAG = "LocalMediaManager"; private static final int MAX_DISCONNECTED_DEVICE_NUM = 5; private static final int MIN_DURATION_BETWEEN_SUGGESTION_REQUESTS_MILLIS = 5000; @Retention(RetentionPolicy.SOURCE) @IntDef({MediaDeviceState.STATE_CONNECTED, Loading Loading @@ -112,6 +113,8 @@ public class LocalMediaManager implements BluetoothCallback { @VisibleForTesting BluetoothAdapter mBluetoothAdapter; private long mLastSuggestionRequestTime = 0L; /** * Register to start receiving callbacks for MediaDevice events. */ Loading Loading @@ -246,7 +249,19 @@ public class LocalMediaManager implements BluetoothCallback { /** Requests a suggestion from other routers. */ public void requestDeviceSuggestion() { // Debounce multiple requests in a short duration long currentRequestTime = System.currentTimeMillis(); if (currentRequestTime - mLastSuggestionRequestTime > MIN_DURATION_BETWEEN_SUGGESTION_REQUESTS_MILLIS) { Log.d(TAG, "requesting device suggestion"); mLastSuggestionRequestTime = currentRequestTime; mInfoMediaManager.requestDeviceSuggestion(); } else { Log.d( TAG, "requestDeviceSuggestion() ignored due to difference between requests: " + (currentRequestTime - mLastSuggestionRequestTime)); } } @Nullable Loading