Revert "Revert "Revert "Correct nullability and final constraints on new APIs."""
This reverts commit b255be1307aeae47ca7e8ee72ab4da670a1c49f1.
Reason for revert: the commit being reverted fixed git_master but broke aosp-master. This revert is aimed to fix aosp-master while not touching git_master.
DO NOT MERGE: This change is aimed at aosp-master only and should not be merged into git_master.
Change-Id: Ie5aaabb211affe2d21daaf87809641276d9d4707
diff --git a/telecomm/java/android/telecom/CallIdentification.java b/telecomm/java/android/telecom/CallIdentification.java
index fffc123..cde7f60 100644
--- a/telecomm/java/android/telecom/CallIdentification.java
+++ b/telecomm/java/android/telecom/CallIdentification.java
@@ -44,7 +44,7 @@
* A {@link CallScreeningService} uses this class to create new instances of
* {@link CallIdentification} for a screened call.
*/
- public final static class Builder {
+ public static class Builder {
private CharSequence mName;
private CharSequence mDescription;
private CharSequence mDetails;
@@ -67,7 +67,7 @@
* @param callIdAppName The app name.
* @hide
*/
- public Builder(@NonNull String callIdPackageName, @NonNull CharSequence callIdAppName) {
+ public Builder(String callIdPackageName, CharSequence callIdAppName) {
mPackageName = callIdPackageName;
mAppName = callIdAppName;
}
@@ -80,7 +80,7 @@
* @param name The name associated with the call, or {@code null} if none is provided.
* @return Builder instance.
*/
- public @NonNull Builder setName(@Nullable CharSequence name) {
+ public Builder setName(@Nullable CharSequence name) {
mName = name;
return this;
}
@@ -97,7 +97,7 @@
* @param description The call description, or {@code null} if none is provided.
* @return Builder instance.
*/
- public @NonNull Builder setDescription(@Nullable CharSequence description) {
+ public Builder setDescription(@Nullable CharSequence description) {
mDescription = description;
return this;
}
@@ -114,8 +114,7 @@
* @param details The call details, or {@code null} if none is provided.
* @return Builder instance.
*/
-
- public @NonNull Builder setDetails(@Nullable CharSequence details) {
+ public Builder setDetails(@Nullable CharSequence details) {
mDetails = details;
return this;
}
@@ -128,7 +127,7 @@
* @param photo The photo associated with the call, or {@code null} if none was provided.
* @return Builder instance.
*/
- public @NonNull Builder setPhoto(@Nullable Icon photo) {
+ public Builder setPhoto(@Nullable Icon photo) {
mPhoto = photo;
return this;
}
@@ -142,7 +141,7 @@
* @param nuisanceConfidence The nuisance confidence.
* @return The builder.
*/
- public @NonNull Builder setNuisanceConfidence(@NuisanceConfidence int nuisanceConfidence) {
+ public Builder setNuisanceConfidence(@NuisanceConfidence int nuisanceConfidence) {
mNuisanceConfidence = nuisanceConfidence;
return this;
}
@@ -153,7 +152,7 @@
*
* @return {@link CallIdentification} instance.
*/
- public @NonNull CallIdentification build() {
+ public CallIdentification build() {
return new CallIdentification(mName, mDescription, mDetails, mPhoto,
mNuisanceConfidence, mPackageName, mAppName);
}
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index ce65cc1..c60eb56 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -17,7 +17,6 @@
import android.Manifest;
import android.annotation.IntDef;
import android.annotation.NonNull;
-import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SuppressAutoDoc;
import android.annotation.SuppressLint;
@@ -805,11 +804,10 @@
* <p>
* The default dialer has access to use this method.
*
- * @return The user outgoing phone account selected by the user, or {@code null} if there is no
- * user selected outgoing {@link PhoneAccountHandle}.
+ * @return The user outgoing phone account selected by the user.
*/
@RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
- public @Nullable PhoneAccountHandle getUserSelectedOutgoingPhoneAccount() {
+ public PhoneAccountHandle getUserSelectedOutgoingPhoneAccount() {
try {
if (isServiceConnected()) {
return getTelecomService().getUserSelectedOutgoingPhoneAccount(
@@ -825,13 +823,12 @@
* Sets the user-chosen default {@link PhoneAccountHandle} for making outgoing phone calls.
*
* @param accountHandle The {@link PhoneAccountHandle} which will be used by default for making
- * outgoing voice calls, or {@code null} if no default is specified (the
- * user will be asked each time a call is placed in this case).
+ * outgoing voice calls.
* @hide
*/
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
@SystemApi
- public void setUserSelectedOutgoingPhoneAccount(@Nullable PhoneAccountHandle accountHandle) {
+ public void setUserSelectedOutgoingPhoneAccount(PhoneAccountHandle accountHandle) {
try {
if (isServiceConnected()) {
getTelecomService().setUserSelectedOutgoingPhoneAccount(accountHandle);
@@ -1198,8 +1195,7 @@
/**
* Used to set the default dialer package.
*
- * @param packageName to set the default dialer to, or {@code null} if the system provided
- * dialer should be used instead.
+ * @param packageName to set the default dialer to.
*
* @result {@code true} if the default dialer was successfully changed, {@code false} if
* the specified package does not correspond to an installed dialer, or is already
@@ -1216,7 +1212,7 @@
@RequiresPermission(allOf = {
android.Manifest.permission.MODIFY_PHONE_STATE,
android.Manifest.permission.WRITE_SECURE_SETTINGS})
- public boolean setDefaultDialer(@Nullable String packageName) {
+ public boolean setDefaultDialer(String packageName) {
try {
if (isServiceConnected()) {
return getTelecomService().setDefaultDialer(packageName);
@@ -1230,10 +1226,9 @@
/**
* Determines the package name of the system-provided default phone app.
*
- * @return package name for the system dialer package or {@code null} if no system dialer is
- * preloaded.
+ * @return package name for the system dialer package or null if no system dialer is preloaded.
*/
- public @Nullable String getSystemDialerPackage() {
+ public String getSystemDialerPackage() {
try {
if (isServiceConnected()) {
return getTelecomService().getSystemDialerPackage();