Merge "Fix multiple PersistentActivity parsing" into main
diff --git a/car-scalable-ui-lib/src/com/android/car/scalableui/model/Role.java b/car-scalable-ui-lib/src/com/android/car/scalableui/model/Role.java index 8f52598..0564999 100644 --- a/car-scalable-ui-lib/src/com/android/car/scalableui/model/Role.java +++ b/car-scalable-ui-lib/src/com/android/car/scalableui/model/Role.java
@@ -26,6 +26,8 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import java.util.Collection; + /** * Represents the role of a {@code Panel} within the system. * @@ -91,14 +93,26 @@ /** Adds a PersistentActivity */ public Builder addPersistentActivity(@NonNull String activityComponent) { + ComponentName componentName = ComponentName.unflattenFromString(activityComponent); + return addPersistentActivity(componentName); + } + + /** Adds a PersistentActivity */ + public Builder addPersistentActivity(@NonNull ComponentName componentName) { mLayoutId = 0; mIsDefault = false; - - ComponentName componentName = ComponentName.unflattenFromString(activityComponent); mPersistedActivities.add(componentName); return this; } + /** Add PersistentActivities */ + public Builder addPersistentActivities(@NonNull Collection<ComponentName> componentNames) { + mLayoutId = 0; + mIsDefault = false; + mPersistedActivities.addAll(componentNames); + return this; + } + /** Sets layout id to be inflated at runtime */ public Builder setLayoutId(@LayoutRes int layoutId) { mIsDefault = false;