Remove boundsWithMargins from ComplicationSlotState
Bug: 236588278
Test: N/A
Relnote: We removed boundsWithMargins from ComplicationSlotState because system software doesn't have a usecase for it.
Change-Id: I42e2670faf421549d8a9d84e4e198992b474886f
diff --git a/wear/watchface/watchface-client/api/current.txt b/wear/watchface/watchface-client/api/current.txt
index 8efb24f..aca452d 100644
--- a/wear/watchface/watchface-client/api/current.txt
+++ b/wear/watchface/watchface-client/api/current.txt
@@ -20,12 +20,10 @@
}
public final class ComplicationSlotState {
- ctor public ComplicationSlotState(android.graphics.Rect bounds, int boundsType, java.util.List<? extends androidx.wear.watchface.complications.data.ComplicationType> supportedTypes, androidx.wear.watchface.complications.DefaultComplicationDataSourcePolicy defaultDataSourcePolicy, boolean isEnabled, boolean isInitiallyEnabled, androidx.wear.watchface.complications.data.ComplicationType currentType, boolean fixedComplicationDataSource, android.os.Bundle complicationConfigExtras, Integer? nameResourceId, Integer? screenReaderNameResourceId, android.graphics.Rect boundsWithMargins);
- ctor @Deprecated public ComplicationSlotState(android.graphics.Rect bounds, int boundsType, java.util.List<? extends androidx.wear.watchface.complications.data.ComplicationType> supportedTypes, androidx.wear.watchface.complications.DefaultComplicationDataSourcePolicy defaultDataSourcePolicy, boolean isEnabled, boolean isInitiallyEnabled, androidx.wear.watchface.complications.data.ComplicationType currentType, boolean fixedComplicationDataSource, android.os.Bundle complicationConfigExtras, Integer? nameResourceId, Integer? screenReaderNameResourceId);
+ ctor public ComplicationSlotState(android.graphics.Rect bounds, int boundsType, java.util.List<? extends androidx.wear.watchface.complications.data.ComplicationType> supportedTypes, androidx.wear.watchface.complications.DefaultComplicationDataSourcePolicy defaultDataSourcePolicy, boolean isEnabled, boolean isInitiallyEnabled, androidx.wear.watchface.complications.data.ComplicationType currentType, boolean fixedComplicationDataSource, android.os.Bundle complicationConfigExtras, Integer? nameResourceId, Integer? screenReaderNameResourceId);
ctor @Deprecated public ComplicationSlotState(android.graphics.Rect bounds, int boundsType, java.util.List<? extends androidx.wear.watchface.complications.data.ComplicationType> supportedTypes, androidx.wear.watchface.complications.DefaultComplicationDataSourcePolicy defaultDataSourcePolicy, androidx.wear.watchface.complications.data.ComplicationType defaultDataSourceType, boolean isEnabled, boolean isInitiallyEnabled, androidx.wear.watchface.complications.data.ComplicationType currentType, boolean fixedComplicationDataSource, android.os.Bundle complicationConfigExtras);
method public android.graphics.Rect getBounds();
method public int getBoundsType();
- method public android.graphics.Rect getBoundsWithMargins();
method public android.os.Bundle getComplicationConfigExtras();
method public androidx.wear.watchface.complications.data.ComplicationType getCurrentType();
method public androidx.wear.watchface.complications.DefaultComplicationDataSourcePolicy getDefaultDataSourcePolicy();
@@ -38,7 +36,6 @@
method public boolean isInitiallyEnabled();
property public final android.graphics.Rect bounds;
property public final int boundsType;
- property public final android.graphics.Rect boundsWithMargins;
property public final android.os.Bundle complicationConfigExtras;
property public final androidx.wear.watchface.complications.data.ComplicationType currentType;
property public final androidx.wear.watchface.complications.DefaultComplicationDataSourcePolicy defaultDataSourcePolicy;
diff --git a/wear/watchface/watchface-client/api/public_plus_experimental_current.txt b/wear/watchface/watchface-client/api/public_plus_experimental_current.txt
index 90066f3..3697506 100644
--- a/wear/watchface/watchface-client/api/public_plus_experimental_current.txt
+++ b/wear/watchface/watchface-client/api/public_plus_experimental_current.txt
@@ -22,14 +22,12 @@
}
public final class ComplicationSlotState {
- ctor public ComplicationSlotState(android.graphics.Rect bounds, int boundsType, java.util.List<? extends androidx.wear.watchface.complications.data.ComplicationType> supportedTypes, androidx.wear.watchface.complications.DefaultComplicationDataSourcePolicy defaultDataSourcePolicy, boolean isEnabled, boolean isInitiallyEnabled, androidx.wear.watchface.complications.data.ComplicationType currentType, boolean fixedComplicationDataSource, android.os.Bundle complicationConfigExtras, Integer? nameResourceId, Integer? screenReaderNameResourceId, android.graphics.Rect boundsWithMargins);
- ctor @Deprecated public ComplicationSlotState(android.graphics.Rect bounds, int boundsType, java.util.List<? extends androidx.wear.watchface.complications.data.ComplicationType> supportedTypes, androidx.wear.watchface.complications.DefaultComplicationDataSourcePolicy defaultDataSourcePolicy, boolean isEnabled, boolean isInitiallyEnabled, androidx.wear.watchface.complications.data.ComplicationType currentType, boolean fixedComplicationDataSource, android.os.Bundle complicationConfigExtras, Integer? nameResourceId, Integer? screenReaderNameResourceId);
- ctor @androidx.wear.watchface.complications.data.ComplicationExperimental public ComplicationSlotState(android.graphics.Rect bounds, android.graphics.Rect boundsWithMargins, int boundsType, java.util.List<? extends androidx.wear.watchface.complications.data.ComplicationType> supportedTypes, androidx.wear.watchface.complications.DefaultComplicationDataSourcePolicy defaultDataSourcePolicy, boolean isEnabled, boolean isInitiallyEnabled, androidx.wear.watchface.complications.data.ComplicationType currentType, boolean fixedComplicationDataSource, android.os.Bundle complicationConfigExtras, Integer? nameResourceId, Integer? screenReaderNameResourceId, androidx.wear.watchface.BoundingArc? edgeComplicationBoundingArc);
+ ctor public ComplicationSlotState(android.graphics.Rect bounds, int boundsType, java.util.List<? extends androidx.wear.watchface.complications.data.ComplicationType> supportedTypes, androidx.wear.watchface.complications.DefaultComplicationDataSourcePolicy defaultDataSourcePolicy, boolean isEnabled, boolean isInitiallyEnabled, androidx.wear.watchface.complications.data.ComplicationType currentType, boolean fixedComplicationDataSource, android.os.Bundle complicationConfigExtras, Integer? nameResourceId, Integer? screenReaderNameResourceId);
+ ctor @androidx.wear.watchface.complications.data.ComplicationExperimental public ComplicationSlotState(android.graphics.Rect bounds, int boundsType, java.util.List<? extends androidx.wear.watchface.complications.data.ComplicationType> supportedTypes, androidx.wear.watchface.complications.DefaultComplicationDataSourcePolicy defaultDataSourcePolicy, boolean isEnabled, boolean isInitiallyEnabled, androidx.wear.watchface.complications.data.ComplicationType currentType, boolean fixedComplicationDataSource, android.os.Bundle complicationConfigExtras, Integer? nameResourceId, Integer? screenReaderNameResourceId, androidx.wear.watchface.BoundingArc? edgeComplicationBoundingArc);
ctor @Deprecated public ComplicationSlotState(android.graphics.Rect bounds, int boundsType, java.util.List<? extends androidx.wear.watchface.complications.data.ComplicationType> supportedTypes, androidx.wear.watchface.complications.DefaultComplicationDataSourcePolicy defaultDataSourcePolicy, androidx.wear.watchface.complications.data.ComplicationType defaultDataSourceType, boolean isEnabled, boolean isInitiallyEnabled, androidx.wear.watchface.complications.data.ComplicationType currentType, boolean fixedComplicationDataSource, android.os.Bundle complicationConfigExtras);
method @androidx.wear.watchface.complications.data.ComplicationExperimental public androidx.wear.watchface.BoundingArc? getBoundingArc();
method public android.graphics.Rect getBounds();
method public int getBoundsType();
- method public android.graphics.Rect getBoundsWithMargins();
method public android.os.Bundle getComplicationConfigExtras();
method public androidx.wear.watchface.complications.data.ComplicationType getCurrentType();
method public androidx.wear.watchface.complications.DefaultComplicationDataSourcePolicy getDefaultDataSourcePolicy();
@@ -42,7 +40,6 @@
method public boolean isInitiallyEnabled();
property public final android.graphics.Rect bounds;
property public final int boundsType;
- property public final android.graphics.Rect boundsWithMargins;
property public final android.os.Bundle complicationConfigExtras;
property public final androidx.wear.watchface.complications.data.ComplicationType currentType;
property public final androidx.wear.watchface.complications.DefaultComplicationDataSourcePolicy defaultDataSourcePolicy;
diff --git a/wear/watchface/watchface-client/api/restricted_current.txt b/wear/watchface/watchface-client/api/restricted_current.txt
index 8efb24f..aca452d 100644
--- a/wear/watchface/watchface-client/api/restricted_current.txt
+++ b/wear/watchface/watchface-client/api/restricted_current.txt
@@ -20,12 +20,10 @@
}
public final class ComplicationSlotState {
- ctor public ComplicationSlotState(android.graphics.Rect bounds, int boundsType, java.util.List<? extends androidx.wear.watchface.complications.data.ComplicationType> supportedTypes, androidx.wear.watchface.complications.DefaultComplicationDataSourcePolicy defaultDataSourcePolicy, boolean isEnabled, boolean isInitiallyEnabled, androidx.wear.watchface.complications.data.ComplicationType currentType, boolean fixedComplicationDataSource, android.os.Bundle complicationConfigExtras, Integer? nameResourceId, Integer? screenReaderNameResourceId, android.graphics.Rect boundsWithMargins);
- ctor @Deprecated public ComplicationSlotState(android.graphics.Rect bounds, int boundsType, java.util.List<? extends androidx.wear.watchface.complications.data.ComplicationType> supportedTypes, androidx.wear.watchface.complications.DefaultComplicationDataSourcePolicy defaultDataSourcePolicy, boolean isEnabled, boolean isInitiallyEnabled, androidx.wear.watchface.complications.data.ComplicationType currentType, boolean fixedComplicationDataSource, android.os.Bundle complicationConfigExtras, Integer? nameResourceId, Integer? screenReaderNameResourceId);
+ ctor public ComplicationSlotState(android.graphics.Rect bounds, int boundsType, java.util.List<? extends androidx.wear.watchface.complications.data.ComplicationType> supportedTypes, androidx.wear.watchface.complications.DefaultComplicationDataSourcePolicy defaultDataSourcePolicy, boolean isEnabled, boolean isInitiallyEnabled, androidx.wear.watchface.complications.data.ComplicationType currentType, boolean fixedComplicationDataSource, android.os.Bundle complicationConfigExtras, Integer? nameResourceId, Integer? screenReaderNameResourceId);
ctor @Deprecated public ComplicationSlotState(android.graphics.Rect bounds, int boundsType, java.util.List<? extends androidx.wear.watchface.complications.data.ComplicationType> supportedTypes, androidx.wear.watchface.complications.DefaultComplicationDataSourcePolicy defaultDataSourcePolicy, androidx.wear.watchface.complications.data.ComplicationType defaultDataSourceType, boolean isEnabled, boolean isInitiallyEnabled, androidx.wear.watchface.complications.data.ComplicationType currentType, boolean fixedComplicationDataSource, android.os.Bundle complicationConfigExtras);
method public android.graphics.Rect getBounds();
method public int getBoundsType();
- method public android.graphics.Rect getBoundsWithMargins();
method public android.os.Bundle getComplicationConfigExtras();
method public androidx.wear.watchface.complications.data.ComplicationType getCurrentType();
method public androidx.wear.watchface.complications.DefaultComplicationDataSourcePolicy getDefaultDataSourcePolicy();
@@ -38,7 +36,6 @@
method public boolean isInitiallyEnabled();
property public final android.graphics.Rect bounds;
property public final int boundsType;
- property public final android.graphics.Rect boundsWithMargins;
property public final android.os.Bundle complicationConfigExtras;
property public final androidx.wear.watchface.complications.data.ComplicationType currentType;
property public final androidx.wear.watchface.complications.DefaultComplicationDataSourcePolicy defaultDataSourcePolicy;
diff --git a/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/ComplicationSlotState.kt b/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/ComplicationSlotState.kt
index de193bd..77a1fcb 100644
--- a/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/ComplicationSlotState.kt
+++ b/wear/watchface/watchface-client/src/main/java/androidx/wear/watchface/client/ComplicationSlotState.kt
@@ -35,12 +35,6 @@
/** Screen space bounds of the [ComplicationSlot] in pixels. */
public val bounds: Rect
- /**
- * Screen space bounds of the [ComplicationSlot] in pixels including any specified margins. This
- * is useful for tap detection (especially for small complications) and doesn't affect rendering.
- */
- public val boundsWithMargins: Rect
-
/** The type of the complication's bounds. */
@ComplicationSlotBoundsType
public val boundsType: Int
@@ -123,8 +117,6 @@
* the complication slot in an editor.
* @param screenReaderNameResourceId The ID of a string resource (or `null` if absent) to
* identify the complication slot in a screen reader.
- * @param boundsWithMargins Screen space bounds of the [ComplicationSlot] in pixels including
- * any specified margins.
*/
public constructor(
bounds: Rect,
@@ -139,72 +131,9 @@
@Suppress("AutoBoxing")
nameResourceId: Int?,
@Suppress("AutoBoxing")
- screenReaderNameResourceId: Int?,
- boundsWithMargins: Rect
- ) {
- this.bounds = bounds
- this.boundsWithMargins = boundsWithMargins
- this.boundsType = boundsType
- this.supportedTypes = supportedTypes
- this.defaultDataSourcePolicy = defaultDataSourcePolicy
- this.isEnabled = isEnabled
- this.isInitiallyEnabled = isInitiallyEnabled
- this.currentType = currentType
- this.fixedComplicationDataSource = fixedComplicationDataSource
- this.complicationConfigExtras = complicationConfigExtras
- this.nameResourceId = nameResourceId
- this.screenReaderNameResourceId = screenReaderNameResourceId
-
- @OptIn(ComplicationExperimental::class)
- this.boundingArc = null
- }
-
- /**
- * @param bounds Screen space bounds of the [ComplicationSlot] in pixels.
- * @param boundsType The type of the complication's bounds.
- * @param supportedTypes The [ComplicationType]s supported by this complication.
- * @param defaultDataSourcePolicy The [DefaultComplicationDataSourcePolicy] for this
- * complication slot.
- * @param isEnabled Whether or not the complication is currently enabled (i.e. it should be
- * drawn).
- * @param isInitiallyEnabled Whether or not the complication was initially enabled before
- * considering any [ComplicationSlotsOption] whose [ComplicationSlotOverlay]s may enable or
- * disable complicationSlots.
- * @param currentType The [ComplicationType] of the complication's current [ComplicationData].
- * @param fixedComplicationDataSource Whether or not the complication data source is fixed (i.e
- * the user can't configure it).
- * @param complicationConfigExtras Extras to be merged into the Intent sent when invoking the
- * complication data source chooser activity.
- * @param nameResourceId The ID of a string resource (or `null` if absent) to visually identify
- * the complication slot in an editor.
- * @param screenReaderNameResourceId The ID of a string resource (or `null` if absent) to
- * identify the complication slot in a screen reader.
- */
- @Deprecated(
- "Constructor without boundsWithMargins is deprecated",
- ReplaceWith(
- "ComplicationSlotState(Rect, Int, List<ComplicationType>, " +
- "DefaultComplicationDataSourcePolicy, Boolean, Boolean, ComplicationType, " +
- "Boolean, Bundle, Int?, Int?, Rect?)"
- )
- )
- public constructor(
- bounds: Rect,
- @ComplicationSlotBoundsType boundsType: Int,
- supportedTypes: List<ComplicationType>,
- defaultDataSourcePolicy: DefaultComplicationDataSourcePolicy,
- isEnabled: Boolean,
- isInitiallyEnabled: Boolean,
- currentType: ComplicationType,
- fixedComplicationDataSource: Boolean,
- complicationConfigExtras: Bundle,
- @Suppress("AutoBoxing")
- nameResourceId: Int?,
- @Suppress("AutoBoxing")
screenReaderNameResourceId: Int?
) {
this.bounds = bounds
- this.boundsWithMargins = bounds
this.boundsType = boundsType
this.supportedTypes = supportedTypes
this.defaultDataSourcePolicy = defaultDataSourcePolicy
@@ -222,8 +151,6 @@
/**
* @param bounds Screen space bounds of the [ComplicationSlot] in pixels.
- * @param boundsWithMargins Screen space bounds of the [ComplicationSlot] in pixels including
- * any specified margins.
* @param boundsType The type of the complication's bounds.
* @param supportedTypes The [ComplicationType]s supported by this complication.
* @param defaultDataSourcePolicy The [DefaultComplicationDataSourcePolicy] for this
@@ -248,7 +175,6 @@
@ComplicationExperimental
public constructor(
bounds: Rect,
- boundsWithMargins: Rect,
@ComplicationSlotBoundsType boundsType: Int,
supportedTypes: List<ComplicationType>,
defaultDataSourcePolicy: DefaultComplicationDataSourcePolicy,
@@ -264,7 +190,6 @@
edgeComplicationBoundingArc: BoundingArc?
) {
this.bounds = bounds
- this.boundsWithMargins = boundsWithMargins
this.boundsType = boundsType
this.supportedTypes = supportedTypes
this.defaultDataSourcePolicy = defaultDataSourcePolicy
@@ -316,7 +241,6 @@
complicationConfigExtras: Bundle
) {
this.bounds = bounds
- this.boundsWithMargins = bounds
this.boundsType = boundsType
this.supportedTypes = supportedTypes
this.defaultDataSourcePolicy = when {
@@ -364,7 +288,6 @@
complicationStateWireFormat: ComplicationStateWireFormat
) : this(
complicationStateWireFormat.bounds,
- complicationStateWireFormat.boundsWithMargins ?: Rect(),
complicationStateWireFormat.boundsType,
complicationStateWireFormat.supportedTypes.map { ComplicationType.fromWireType(it) },
DefaultComplicationDataSourcePolicy(
@@ -394,7 +317,7 @@
@Suppress("Deprecation")
override fun toString(): String {
@OptIn(ComplicationExperimental::class)
- return "ComplicationSlotState(bounds=$bounds, boundsWithMargins=$boundsWithMargins, " +
+ return "ComplicationSlotState(bounds=$bounds, " +
"boundsType=$boundsType, supportedTypes=$supportedTypes, " +
"defaultDataSourcePolicy=$defaultDataSourcePolicy, " +
"defaultDataSourceType=$defaultDataSourceType, isEnabled=$isEnabled, " +
@@ -414,7 +337,6 @@
other as ComplicationSlotState
if (bounds != other.bounds) return false
- if (boundsWithMargins != other.boundsWithMargins) return false
if (boundsType != other.boundsType) return false
if (supportedTypes != other.supportedTypes) return false
if (defaultDataSourcePolicy != other.defaultDataSourcePolicy) return false
@@ -435,7 +357,6 @@
@Suppress("Deprecation")
override fun hashCode(): Int {
var result = bounds.hashCode()
- result = 31 * result + boundsWithMargins.hashCode()
result = 31 * result + boundsType
result = 31 * result + supportedTypes.hashCode()
result = 31 * result + defaultDataSourcePolicy.hashCode()
diff --git a/wear/watchface/watchface-editor/src/main/java/androidx/wear/watchface/editor/EditorSession.kt b/wear/watchface/watchface-editor/src/main/java/androidx/wear/watchface/editor/EditorSession.kt
index 2e81b76..e20b6f8 100644
--- a/wear/watchface/watchface-editor/src/main/java/androidx/wear/watchface/editor/EditorSession.kt
+++ b/wear/watchface/watchface-editor/src/main/java/androidx/wear/watchface/editor/EditorSession.kt
@@ -809,7 +809,6 @@
}
ComplicationSlotState(
it.value.computeBounds(editorDelegate.screenBounds, type, applyMargins = false),
- it.value.computeBounds(editorDelegate.screenBounds, type, applyMargins = true),
it.value.boundsType,
it.value.supportedTypes,
it.value.defaultDataSourcePolicy,