Fix google3 warnings
Test: Building
Change-Id: Icca4f447843cdcd4072b9bef9dd93591a53bc3a7
diff --git a/car-ui-lib/src/com/android/car/ui/preference/ListPreferenceFragment.java b/car-ui-lib/src/com/android/car/ui/preference/ListPreferenceFragment.java
index 3af1f8a..d0653dd 100644
--- a/car-ui-lib/src/com/android/car/ui/preference/ListPreferenceFragment.java
+++ b/car-ui-lib/src/com/android/car/ui/preference/ListPreferenceFragment.java
@@ -18,8 +18,6 @@
import static com.android.car.ui.preference.PreferenceDialogFragment.ARG_KEY;
-import static java.util.stream.Collectors.toList;
-
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@@ -36,7 +34,7 @@
import com.android.car.ui.recyclerview.CarUiRecyclerView;
import com.android.car.ui.toolbar.Toolbar;
-import java.util.Arrays;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -115,8 +113,10 @@
}
mClickedDialogEntryIndex = preference.findIndexOfValue(preference.getValue());
- List<String> entryStrings = Arrays.stream(entries).map(CharSequence::toString).collect(
- toList());
+ List<String> entryStrings = new ArrayList<>(entries.length);
+ for (CharSequence entry : entries) {
+ entryStrings.add(entry.toString());
+ }
CarUiRecyclerViewRadioButtonAdapter adapter = new CarUiRecyclerViewRadioButtonAdapter(
entryStrings, mClickedDialogEntryIndex);
diff --git a/car-ui-lib/src/com/android/car/ui/preference/PreferenceFragment.java b/car-ui-lib/src/com/android/car/ui/preference/PreferenceFragment.java
index e459233..1acb2d2 100644
--- a/car-ui-lib/src/com/android/car/ui/preference/PreferenceFragment.java
+++ b/car-ui-lib/src/com/android/car/ui/preference/PreferenceFragment.java
@@ -41,12 +41,13 @@
import com.android.car.ui.R;
import com.android.car.ui.toolbar.Toolbar;
+import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Stack;
/**
* A PreferenceFragmentCompat is the entry point to using the Preference library.
@@ -159,11 +160,11 @@
List<Preference> children = new ArrayList<>();
// Stack of preferences to process
- Stack<Preference> stack = new Stack<>();
- stack.push(preferenceScreen);
+ Deque<Preference> stack = new ArrayDeque<>();
+ stack.addFirst(preferenceScreen);
- while (!stack.empty()) {
- Preference preference = stack.pop();
+ while (!stack.isEmpty()) {
+ Preference preference = stack.removeFirst();
if (preference instanceof PreferenceGroup) {
PreferenceGroup pg = (PreferenceGroup) preference;
@@ -180,7 +181,7 @@
dependencies.put(replacement, child.getDependency());
pg.addPreference(replacement);
- stack.push(replacement);
+ stack.addFirst(replacement);
}
}
}
diff --git a/car-ui-lib/src/com/android/car/ui/recyclerview/CarUiListItemLayoutManager.java b/car-ui-lib/src/com/android/car/ui/recyclerview/CarUiListItemLayoutManager.java
index c825052..80572a5 100644
--- a/car-ui-lib/src/com/android/car/ui/recyclerview/CarUiListItemLayoutManager.java
+++ b/car-ui-lib/src/com/android/car/ui/recyclerview/CarUiListItemLayoutManager.java
@@ -133,7 +133,7 @@
}
}
- return (mListItemHeights.get(firstPos)) + heightOfScreen;
+ return mListItemHeights.get(firstPos) + heightOfScreen;
}
/**
diff --git a/car-ui-lib/tests/paintbooth/src/com/android/car/ui/paintbooth/MainActivity.java b/car-ui-lib/tests/paintbooth/src/com/android/car/ui/paintbooth/MainActivity.java
index baf7ece..f05a827 100644
--- a/car-ui-lib/tests/paintbooth/src/com/android/car/ui/paintbooth/MainActivity.java
+++ b/car-ui-lib/tests/paintbooth/src/com/android/car/ui/paintbooth/MainActivity.java
@@ -152,9 +152,9 @@
.getMethod("getDumpHeap").invoke(currentConfig);
Boolean dumpHeapWhenDebugging = (Boolean) configClass
.getMethod("getDumpHeapWhenDebugging").invoke(currentConfig);
- List referenceMatchers = (List) configClass
+ List<?> referenceMatchers = (List<?>) configClass
.getMethod("getReferenceMatchers").invoke(currentConfig);
- List objectInspectors = (List) configClass
+ List<?> objectInspectors = (List<?>) configClass
.getMethod("getObjectInspectors").invoke(currentConfig);
Object onHeapAnalyzedListener = configClass
.getMethod("getOnHeapAnalyzedListener").invoke(currentConfig);
diff --git a/car-ui-lib/tests/paintbooth/src/com/android/car/ui/paintbooth/dialogs/DialogsActivity.java b/car-ui-lib/tests/paintbooth/src/com/android/car/ui/paintbooth/dialogs/DialogsActivity.java
index 37b1c20..505a026 100644
--- a/car-ui-lib/tests/paintbooth/src/com/android/car/ui/paintbooth/dialogs/DialogsActivity.java
+++ b/car-ui-lib/tests/paintbooth/src/com/android/car/ui/paintbooth/dialogs/DialogsActivity.java
@@ -39,7 +39,7 @@
*/
public class DialogsActivity extends Activity {
- private List<Pair<Integer, View.OnClickListener>> mButtons = new ArrayList<>();
+ private final List<Pair<Integer, View.OnClickListener>> mButtons = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -174,7 +174,7 @@
}
}
- private CarUiRecyclerView.Adapter<ViewHolder> mAdapter =
+ private final CarUiRecyclerView.Adapter<ViewHolder> mAdapter =
new CarUiRecyclerView.Adapter<ViewHolder>() {
@Override
public int getItemCount() {