Add get prefix to getters in enterprise-feedback.
Test: ./gradlew :enterprise-feedback:test
Bug: 129753642
Change-Id: I4647ccd863550b15d001ae53cc190d2c7e8314fb
diff --git a/enterprise/feedback/api/1.0.0-alpha02.txt b/enterprise/feedback/api/1.0.0-alpha02.txt
index ca2cec6..e85daff 100644
--- a/enterprise/feedback/api/1.0.0-alpha02.txt
+++ b/enterprise/feedback/api/1.0.0-alpha02.txt
@@ -3,10 +3,10 @@
public abstract class KeyedAppState {
method public static androidx.enterprise.feedback.KeyedAppState.KeyedAppStateBuilder builder();
- method public abstract String? data();
- method public abstract String key();
- method public abstract String? message();
- method public abstract int severity();
+ method public abstract String? getData();
+ method public abstract String getKey();
+ method public abstract String? getMessage();
+ method public abstract int getSeverity();
field public static final int MAX_DATA_LENGTH = 1000; // 0x3e8
field public static final int MAX_KEY_LENGTH = 100; // 0x64
field public static final int MAX_MESSAGE_LENGTH = 1000; // 0x3e8
@@ -38,12 +38,12 @@
public abstract class ReceivedKeyedAppState {
method public static androidx.enterprise.feedback.ReceivedKeyedAppState.ReceivedKeyedAppStateBuilder builder();
- method public abstract String? data();
- method public abstract String key();
- method public abstract String? message();
- method public abstract String packageName();
- method public abstract int severity();
- method public abstract long timestamp();
+ method public abstract String? getData();
+ method public abstract String getKey();
+ method public abstract String? getMessage();
+ method public abstract String getPackageName();
+ method public abstract int getSeverity();
+ method public abstract long getTimestamp();
}
public abstract static class ReceivedKeyedAppState.ReceivedKeyedAppStateBuilder {
diff --git a/enterprise/feedback/api/current.txt b/enterprise/feedback/api/current.txt
index ca2cec6..e85daff 100644
--- a/enterprise/feedback/api/current.txt
+++ b/enterprise/feedback/api/current.txt
@@ -3,10 +3,10 @@
public abstract class KeyedAppState {
method public static androidx.enterprise.feedback.KeyedAppState.KeyedAppStateBuilder builder();
- method public abstract String? data();
- method public abstract String key();
- method public abstract String? message();
- method public abstract int severity();
+ method public abstract String? getData();
+ method public abstract String getKey();
+ method public abstract String? getMessage();
+ method public abstract int getSeverity();
field public static final int MAX_DATA_LENGTH = 1000; // 0x3e8
field public static final int MAX_KEY_LENGTH = 100; // 0x64
field public static final int MAX_MESSAGE_LENGTH = 1000; // 0x3e8
@@ -38,12 +38,12 @@
public abstract class ReceivedKeyedAppState {
method public static androidx.enterprise.feedback.ReceivedKeyedAppState.ReceivedKeyedAppStateBuilder builder();
- method public abstract String? data();
- method public abstract String key();
- method public abstract String? message();
- method public abstract String packageName();
- method public abstract int severity();
- method public abstract long timestamp();
+ method public abstract String? getData();
+ method public abstract String getKey();
+ method public abstract String? getMessage();
+ method public abstract String getPackageName();
+ method public abstract int getSeverity();
+ method public abstract long getTimestamp();
}
public abstract static class ReceivedKeyedAppState.ReceivedKeyedAppStateBuilder {
diff --git a/enterprise/feedback/src/main/java/androidx/enterprise/feedback/KeyedAppState.java b/enterprise/feedback/src/main/java/androidx/enterprise/feedback/KeyedAppState.java
index edc91bf..ad05fa8 100644
--- a/enterprise/feedback/src/main/java/androidx/enterprise/feedback/KeyedAppState.java
+++ b/enterprise/feedback/src/main/java/androidx/enterprise/feedback/KeyedAppState.java
@@ -66,11 +66,10 @@
/**
* The key for the app state. Acts as a point of reference for what the app is providing state
* for. For example, when providing managed configuration feedback, this key could be the
- * managed
- * configuration key to allow EMMs to take advantage of the connection in their UI.
+ * managed configuration key to allow EMMs to take advantage of the connection in their UI.
*/
@NonNull
- public abstract String key();
+ public abstract String getKey();
/**
* The severity of the app state. This allows EMMs to choose to notify admins of errors. This
@@ -78,11 +77,11 @@
* organization needs to take action to fix.
*
* <p>When sending an app state containing errors, it is critical that follow-up app states are
- * sent when the errors have been resolved, using the same {@link #key()} and this value set to
+ * sent when the errors have been resolved, using the same key and this value set to
* {@link #SEVERITY_INFO}.
*/
@Severity
- public abstract int severity();
+ public abstract int getSeverity();
/**
* Optionally, a free-form message string to explain the app state. If the state was
@@ -90,7 +89,7 @@
* included in the message.
*/
@Nullable
- public abstract String message();
+ public abstract String getMessage();
/**
* Optionally, a machine-readable value to be read by the EMM. For example, setting values that
@@ -98,17 +97,17 @@
* battery_warning data < 10”).
*/
@Nullable
- public abstract String data();
+ public abstract String getData();
Bundle toStateBundle() {
Bundle bundle = new Bundle();
- bundle.putString(APP_STATE_KEY, key());
- bundle.putInt(APP_STATE_SEVERITY, severity());
- if (message() != null) {
- bundle.putString(APP_STATE_MESSAGE, message());
+ bundle.putString(APP_STATE_KEY, getKey());
+ bundle.putInt(APP_STATE_SEVERITY, getSeverity());
+ if (getMessage() != null) {
+ bundle.putString(APP_STATE_MESSAGE, getMessage());
}
- if (data() != null) {
- bundle.putString(APP_STATE_DATA, data());
+ if (getData() != null) {
+ bundle.putString(APP_STATE_DATA, getData());
}
return bundle;
}
@@ -158,19 +157,19 @@
// Create a no-args constructor so it doesn't appear in current.txt
KeyedAppStateBuilder() {}
- /** Set {@link KeyedAppState#key()}. */
+ /** Set {@link KeyedAppState#getKey()}. */
@NonNull
public abstract KeyedAppStateBuilder setKey(@NonNull String key);
- /** Set {@link KeyedAppState#severity()}. */
+ /** Set {@link KeyedAppState#getSeverity()}. */
@NonNull
public abstract KeyedAppStateBuilder setSeverity(@Severity int severity);
- /** Set {@link KeyedAppState#message()}. */
+ /** Set {@link KeyedAppState#getMessage()}. */
@NonNull
public abstract KeyedAppStateBuilder setMessage(@Nullable String message);
- /** Set {@link KeyedAppState#data()}. */
+ /** Set {@link KeyedAppState#getData()}. */
@NonNull
public abstract KeyedAppStateBuilder setData(@Nullable String data);
@@ -188,24 +187,25 @@
@NonNull
public KeyedAppState build() {
KeyedAppState keyedAppState = autoBuild();
- if (keyedAppState.key().length() > MAX_KEY_LENGTH) {
+ if (keyedAppState.getKey().length() > MAX_KEY_LENGTH) {
throw new IllegalStateException(
String.format("Key length can be at most %s", MAX_KEY_LENGTH));
}
- if (keyedAppState.message() != null
- && keyedAppState.message().length() > MAX_MESSAGE_LENGTH) {
+ if (keyedAppState.getMessage() != null
+ && keyedAppState.getMessage().length() > MAX_MESSAGE_LENGTH) {
throw new IllegalStateException(
String.format("Message length can be at most %s", MAX_MESSAGE_LENGTH));
}
- if (keyedAppState.data() != null && keyedAppState.data().length() > MAX_DATA_LENGTH) {
+ if (keyedAppState.getData() != null
+ && keyedAppState.getData().length() > MAX_DATA_LENGTH) {
throw new IllegalStateException(
String.format("Data length can be at most %s", MAX_DATA_LENGTH));
}
- if (keyedAppState.severity() != SEVERITY_ERROR
- && keyedAppState.severity() != SEVERITY_INFO) {
+ if (keyedAppState.getSeverity() != SEVERITY_ERROR
+ && keyedAppState.getSeverity() != SEVERITY_INFO) {
throw new IllegalStateException("Severity must be SEVERITY_ERROR or SEVERITY_INFO");
}
diff --git a/enterprise/feedback/src/main/java/androidx/enterprise/feedback/KeyedAppStatesReporter.java b/enterprise/feedback/src/main/java/androidx/enterprise/feedback/KeyedAppStatesReporter.java
index 806829d..0fea1b5 100644
--- a/enterprise/feedback/src/main/java/androidx/enterprise/feedback/KeyedAppStatesReporter.java
+++ b/enterprise/feedback/src/main/java/androidx/enterprise/feedback/KeyedAppStatesReporter.java
@@ -73,28 +73,28 @@
/**
* The name for the keyed app state key for a given bundle in {@link #APP_STATES}.
*
- * @see KeyedAppState#key()
+ * @see KeyedAppState#getKey()
*/
static final String APP_STATE_KEY = "androidx.enterprise.feedback.APP_STATE_KEY";
/**
* The name for the severity of the app state.
*
- * @see KeyedAppState#severity()
+ * @see KeyedAppState#getSeverity()
*/
static final String APP_STATE_SEVERITY = "androidx.enterprise.feedback.APP_STATE_SEVERITY";
/**
* The name for the optional app state message for a given bundle in {@link #APP_STATES}.
*
- * @see KeyedAppState#message()
+ * @see KeyedAppState#getMessage()
*/
static final String APP_STATE_MESSAGE = "androidx.enterprise.feedback.APP_STATE_MESSAGE";
/**
* The name for the optional app state data for a given bundle in {@link #APP_STATES}.
*
- * @see KeyedAppState#data()
+ * @see KeyedAppState#getData()
*/
static final String APP_STATE_DATA = "androidx.enterprise.feedback.APP_STATE_DATA";
@@ -182,14 +182,12 @@
/**
* Set app states to be sent to an EMM (enterprise mobility management). The EMM can then
- * display
- * this information to the management organization.
+ * display this information to the management organization.
*
* <p>Do not send personally-identifiable information with this method.
*
* <p>Each provided keyed app state will replace any previously set keyed app states with the
- * same
- * key for this package name.
+ * same key for this package name.
*
* <p>If multiple keyed app states are set with the same key, only one will be received by the
* EMM. Which will be received is not defined.
@@ -201,7 +199,7 @@
* <p>EMMs can access these states either directly in a custom DPC (device policy manager), via
* Android Management APIs, or via Play EMM APIs.
*
- * @see #setStatesImmediate(Collection) to request that states are uploaded immediately
+ * @see #setStatesImmediate(Collection)
*/
public void setStates(@NonNull Collection<KeyedAppState> states) {
setStates(states, false);
@@ -224,12 +222,12 @@
}
/**
- * Performs the same function as {@link #setStates(Collection)}, except it also
- * requests
- * that the states are immediately uploaded to be accessible via server APIs.
+ * Performs the same function as {@link #setStates(Collection)}, except it
+ * also requests that the states are immediately uploaded to be accessible
+ * via server APIs.
*
- * <p>The receiver is not obligated to meet this immediate upload request. For example, Play and
- * Android Management APIs have daily quotas.
+ * <p>The receiver is not obligated to meet this immediate upload request.
+ * For example, Play and Android Management APIs have daily quotas.
*/
public void setStatesImmediate(@NonNull Collection<KeyedAppState> states) {
setStates(states, true);
diff --git a/enterprise/feedback/src/main/java/androidx/enterprise/feedback/KeyedAppStatesService.java b/enterprise/feedback/src/main/java/androidx/enterprise/feedback/KeyedAppStatesService.java
index e10a5aa..28b43fd 100644
--- a/enterprise/feedback/src/main/java/androidx/enterprise/feedback/KeyedAppStatesService.java
+++ b/enterprise/feedback/src/main/java/androidx/enterprise/feedback/KeyedAppStatesService.java
@@ -172,7 +172,7 @@
Collection<ReceivedKeyedAppState> keyedAppStates) {
Map<String, ReceivedKeyedAppState> mappedStates = new HashMap<>();
for (ReceivedKeyedAppState state : keyedAppStates) {
- mappedStates.put(state.key(), state);
+ mappedStates.put(state.getKey(), state);
}
return mappedStates.values();
@@ -190,9 +190,8 @@
* Called when an app sends states. States are key/value, so new values should replace existing
* ones for the same key.
*
- * @param states The states sent by an app. Every state will have the same {@link
- * ReceivedKeyedAppState#packageName()} and
- * {@link ReceivedKeyedAppState#timestamp()}.
+ * @param states The states sent by an app. Every state will have the same packageName
+ * and timestamp.
* @param requestSync {@code true} if the app requests an immediate upload for access by server
* APIs. This immediate upload request does not have to be respected if a
* quota that you have defined has been exceeded.
diff --git a/enterprise/feedback/src/main/java/androidx/enterprise/feedback/ReceivedKeyedAppState.java b/enterprise/feedback/src/main/java/androidx/enterprise/feedback/ReceivedKeyedAppState.java
index f3d5212..c6742a0 100644
--- a/enterprise/feedback/src/main/java/androidx/enterprise/feedback/ReceivedKeyedAppState.java
+++ b/enterprise/feedback/src/main/java/androidx/enterprise/feedback/ReceivedKeyedAppState.java
@@ -31,8 +31,8 @@
/**
* A keyed app state received from an app. This contains all of the information added by the app to
- * the {@link KeyedAppState} as well as the {@link #packageName()} and {@link #timestamp()} added
- * when the state was received.
+ * the {@link KeyedAppState} as well as the packageName and timestamp added when the state
+ * was received.
*/
@AutoValue
public abstract class ReceivedKeyedAppState {
@@ -69,7 +69,7 @@
* the app sending the feedback.
*/
@NonNull
- public abstract String packageName();
+ public abstract String getPackageName();
/**
* The unix timestamp, in milliseconds, when the states were received.
@@ -77,22 +77,22 @@
* <p>This is automatically set to the correct value by the receiver; it is NOT self-reported by
* the app sending the feedback.
*/
- public abstract long timestamp();
+ public abstract long getTimestamp();
- /** See {@link KeyedAppState#key()} */
+ /** See {@link KeyedAppState#getKey()} */
@NonNull
- public abstract String key();
+ public abstract String getKey();
- /** See {@link KeyedAppState#severity()} */
- public abstract int severity();
+ /** See {@link KeyedAppState#getSeverity()} */
+ public abstract int getSeverity();
- /** See {@link KeyedAppState#message()} */
+ /** See {@link KeyedAppState#getMessage()} */
@Nullable
- public abstract String message();
+ public abstract String getMessage();
- /** See {@link KeyedAppState#data()} */
+ /** See {@link KeyedAppState#getData()} */
@Nullable
- public abstract String data();
+ public abstract String getData();
/** The builder for {@link ReceivedKeyedAppState}. */
@AutoValue.Builder
@@ -101,27 +101,27 @@
// Create a no-args constructor so it doesn't appear in current.txt
ReceivedKeyedAppStateBuilder() {}
- /** Set {@link ReceivedKeyedAppState#packageName()}. */
+ /** Set {@link ReceivedKeyedAppState#getPackageName()}. */
@NonNull
public abstract ReceivedKeyedAppStateBuilder setPackageName(@NonNull String packageName);
- /** Set {@link ReceivedKeyedAppState#timestamp()}. */
+ /** Set {@link ReceivedKeyedAppState#getTimestamp()}. */
@NonNull
public abstract ReceivedKeyedAppStateBuilder setTimestamp(long timestamp);
- /** Set {@link ReceivedKeyedAppState#key()}. */
+ /** Set {@link ReceivedKeyedAppState#getKey()}. */
@NonNull
public abstract ReceivedKeyedAppStateBuilder setKey(@NonNull String key);
- /** Set {@link ReceivedKeyedAppState#severity()}. */
+ /** Set {@link ReceivedKeyedAppState#getSeverity()}. */
@NonNull
public abstract ReceivedKeyedAppStateBuilder setSeverity(@Severity int severity);
- /** Set {@link ReceivedKeyedAppState#message()}. */
+ /** Set {@link ReceivedKeyedAppState#getMessage()}. */
@NonNull
public abstract ReceivedKeyedAppStateBuilder setMessage(@Nullable String message);
- /** Set {@link ReceivedKeyedAppState#data()}. */
+ /** Set {@link ReceivedKeyedAppState#getData()}. */
@NonNull
public abstract ReceivedKeyedAppStateBuilder setData(@Nullable String data);
diff --git a/enterprise/feedback/src/test/java/androidx/enterprise/feedback/KeyedAppStateTest.java b/enterprise/feedback/src/test/java/androidx/enterprise/feedback/KeyedAppStateTest.java
index 61e30c2..095d40a 100644
--- a/enterprise/feedback/src/test/java/androidx/enterprise/feedback/KeyedAppStateTest.java
+++ b/enterprise/feedback/src/test/java/androidx/enterprise/feedback/KeyedAppStateTest.java
@@ -173,10 +173,10 @@
KeyedAppState keyedAppState = KeyedAppState.fromBundle(bundle);
- assertThat(keyedAppState.key()).isEqualTo(KEY);
- assertThat(keyedAppState.message()).isEqualTo(MESSAGE);
- assertThat(keyedAppState.severity()).isEqualTo(SEVERITY);
- assertThat(keyedAppState.data()).isEqualTo(DATA);
+ assertThat(keyedAppState.getKey()).isEqualTo(KEY);
+ assertThat(keyedAppState.getMessage()).isEqualTo(MESSAGE);
+ assertThat(keyedAppState.getSeverity()).isEqualTo(SEVERITY);
+ assertThat(keyedAppState.getData()).isEqualTo(DATA);
}
@Test
@@ -196,7 +196,7 @@
public void severityDefaultsToInfo() {
KeyedAppState keyedAppState = KeyedAppState.builder().setKey(KEY).build();
- assertThat(keyedAppState.severity()).isEqualTo(SEVERITY_INFO);
+ assertThat(keyedAppState.getSeverity()).isEqualTo(SEVERITY_INFO);
}
@Test
@@ -204,7 +204,7 @@
public void messageDefaultsToNull() {
KeyedAppState keyedAppState = KeyedAppState.builder().setKey(KEY).build();
- assertThat(keyedAppState.message()).isNull();
+ assertThat(keyedAppState.getMessage()).isNull();
}
@Test
@@ -212,7 +212,7 @@
public void dataDefaultsToNull() {
KeyedAppState keyedAppState = KeyedAppState.builder().setKey(KEY).build();
- assertThat(keyedAppState.data()).isNull();
+ assertThat(keyedAppState.getData()).isNull();
}
@Test
diff --git a/enterprise/feedback/src/test/java/androidx/enterprise/feedback/KeyedAppStatesServiceTest.java b/enterprise/feedback/src/test/java/androidx/enterprise/feedback/KeyedAppStatesServiceTest.java
index d0043dd..20db1fd 100644
--- a/enterprise/feedback/src/test/java/androidx/enterprise/feedback/KeyedAppStatesServiceTest.java
+++ b/enterprise/feedback/src/test/java/androidx/enterprise/feedback/KeyedAppStatesServiceTest.java
@@ -132,10 +132,10 @@
for (ReceivedKeyedAppState receivedState : receivedStates) {
states.add(
KeyedAppState.builder()
- .setKey(receivedState.key())
- .setSeverity(receivedState.severity())
- .setMessage(receivedState.message())
- .setData(receivedState.data())
+ .setKey(receivedState.getKey())
+ .setSeverity(receivedState.getSeverity())
+ .setMessage(receivedState.getMessage())
+ .setData(receivedState.getData())
.build());
}
return states;
@@ -149,7 +149,7 @@
mMessenger.send(createTestStateMessage());
ReceivedKeyedAppState receivedState = mKeyedAppStatesService.mStates.iterator().next();
- long timestamp = receivedState.timestamp();
+ long timestamp = receivedState.getTimestamp();
assertThat(timestamp).isEqualTo(CURRENT_TIME_MILLIS);
}
@@ -162,7 +162,7 @@
mMessenger.send(createTestStateMessage());
ReceivedKeyedAppState receivedState = mKeyedAppStatesService.mStates.iterator().next();
- assertThat(receivedState.packageName()).isEqualTo(packageName);
+ assertThat(receivedState.getPackageName()).isEqualTo(packageName);
}
@Test
diff --git a/enterprise/feedback/src/test/java/androidx/enterprise/feedback/ReceivedKeyedAppStateTest.java b/enterprise/feedback/src/test/java/androidx/enterprise/feedback/ReceivedKeyedAppStateTest.java
index 77c632e..4481740 100644
--- a/enterprise/feedback/src/test/java/androidx/enterprise/feedback/ReceivedKeyedAppStateTest.java
+++ b/enterprise/feedback/src/test/java/androidx/enterprise/feedback/ReceivedKeyedAppStateTest.java
@@ -62,12 +62,12 @@
ReceivedKeyedAppState state = ReceivedKeyedAppState.fromBundle(bundle, PACKAGE_NAME,
TIMESTAMP);
- assertThat(state.key()).isEqualTo(KEY);
- assertThat(state.message()).isEqualTo(MESSAGE);
- assertThat(state.severity()).isEqualTo(SEVERITY);
- assertThat(state.data()).isEqualTo(DATA);
- assertThat(state.packageName()).isEqualTo(PACKAGE_NAME);
- assertThat(state.timestamp()).isEqualTo(TIMESTAMP);
+ assertThat(state.getKey()).isEqualTo(KEY);
+ assertThat(state.getMessage()).isEqualTo(MESSAGE);
+ assertThat(state.getSeverity()).isEqualTo(SEVERITY);
+ assertThat(state.getData()).isEqualTo(DATA);
+ assertThat(state.getPackageName()).isEqualTo(PACKAGE_NAME);
+ assertThat(state.getTimestamp()).isEqualTo(TIMESTAMP);
}
@Test