diff options
author | erfanian <erfanian@google.com> | 2017-08-03 18:00:40 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-08-04 10:48:05 -0700 |
commit | 911a90842eb6af7b4a8a6cc0d07329655eaef8c4 (patch) | |
tree | 7ef876ebfcc76190ddef4b2b0c7e2d7a27a60d11 /java/com/android/incallui/incall/impl/MappedButtonConfig.java | |
parent | 848f1c463a162e4423433f988859336ae61de6d7 (diff) |
Fix buttom mapping issue for wifi handoff.
Introduce the concept of a "mutually exclusive button".
Buttons that conflict with a "mutually exclusive button" that
is eligible to be placed, will never be placed.
Bug: 37275934
Test: unit tests.
PiperOrigin-RevId: 164210228
Change-Id: I64af6065c89d143a331ea226f9a6cb1004b5a155
Diffstat (limited to 'java/com/android/incallui/incall/impl/MappedButtonConfig.java')
-rw-r--r-- | java/com/android/incallui/incall/impl/MappedButtonConfig.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/java/com/android/incallui/incall/impl/MappedButtonConfig.java b/java/com/android/incallui/incall/impl/MappedButtonConfig.java index 722983796..67c4137b9 100644 --- a/java/com/android/incallui/incall/impl/MappedButtonConfig.java +++ b/java/com/android/incallui/incall/impl/MappedButtonConfig.java @@ -141,7 +141,7 @@ final class MappedButtonConfig { } @NonNull - private MappingInfo lookupMappingInfo(@InCallButtonIds int button) { + public MappingInfo lookupMappingInfo(@InCallButtonIds int button) { MappingInfo info = mapping.get(button); if (info == null) { throw new IllegalArgumentException( @@ -154,6 +154,8 @@ final class MappedButtonConfig { @AutoValue abstract static class MappingInfo { + public static final int NO_MUTUALLY_EXCLUSIVE_BUTTON_SET = -1; + /** The Ui slot into which a given button desires to be placed. */ public abstract int getSlot(); @@ -171,11 +173,20 @@ final class MappedButtonConfig { */ public abstract int getConflictOrder(); + /** + * Returns an integer representing a button for which the given button conflicts. Defaults to + * {@link NO_MUTUALLY_EXCLUSIVE_BUTTON_SET}. + * + * <p>If the mutually exclusive button is chosen, the associated button should never be chosen. + */ + public abstract @InCallButtonIds int getMutuallyExclusiveButton(); + static Builder builder(int slot) { return new AutoValue_MappedButtonConfig_MappingInfo.Builder() .setSlot(slot) .setSlotOrder(Integer.MAX_VALUE) - .setConflictOrder(Integer.MAX_VALUE); + .setConflictOrder(Integer.MAX_VALUE) + .setMutuallyExclusiveButton(NO_MUTUALLY_EXCLUSIVE_BUTTON_SET); } /** Class used to build instances of {@link MappingInfo}. */ @@ -187,6 +198,8 @@ final class MappedButtonConfig { public abstract Builder setConflictOrder(int conflictOrder); + public abstract Builder setMutuallyExclusiveButton(@InCallButtonIds int button); + public abstract MappingInfo build(); } } |