diff options
author | Tyler Gunn <tgunn@google.com> | 2019-02-28 11:33:42 -0800 |
---|---|---|
committer | Tyler Gunn <tgunn@google.com> | 2019-03-04 08:28:22 -0800 |
commit | e694ef523bd7b15cb15aa76b1a66b94c7b32d349 (patch) | |
tree | 7fd8f317154db836be0052092821569d7434ec90 | |
parent | 0bbf61f024eccd569c9886c78c041acc59f2e04a (diff) |
Correct nullability and final constraints on new APIs.
Per API review, correct nullability and final constraints on new Telecom
APIs.
Test: Build API.
Fixes: 126700293
Fixes: 126699447
Fixes: 126700465
Fixes: 126702895
Fixes: 126702527
Change-Id: Ic19664b156410e79a307b2af0d5672dc19f93c59
Merged-In: Icec15403493de596194a61b27bb3e1031fdc1099
-rwxr-xr-x | api/current.txt | 18 | ||||
-rw-r--r-- | api/system-current.txt | 4 | ||||
-rw-r--r-- | api/test-current.txt | 2 | ||||
-rw-r--r-- | telecomm/java/android/telecom/CallIdentification.java | 17 | ||||
-rw-r--r-- | telecomm/java/android/telecom/TelecomManager.java | 21 |
5 files changed, 34 insertions, 28 deletions
diff --git a/api/current.txt b/api/current.txt index 78702927ddc8..44ddde2a429e 100755 --- a/api/current.txt +++ b/api/current.txt @@ -41262,14 +41262,14 @@ package android.telecom { field public static final android.os.Parcelable.Creator<android.telecom.CallIdentification> CREATOR; } - public static class CallIdentification.Builder { + public static final class CallIdentification.Builder { ctor public CallIdentification.Builder(); - method public android.telecom.CallIdentification build(); - method public android.telecom.CallIdentification.Builder setDescription(@Nullable CharSequence); - method public android.telecom.CallIdentification.Builder setDetails(@Nullable CharSequence); - method public android.telecom.CallIdentification.Builder setName(@Nullable CharSequence); - method public android.telecom.CallIdentification.Builder setNuisanceConfidence(int); - method public android.telecom.CallIdentification.Builder setPhoto(@Nullable android.graphics.drawable.Icon); + method @NonNull public android.telecom.CallIdentification build(); + method @NonNull public android.telecom.CallIdentification.Builder setDescription(@Nullable CharSequence); + method @NonNull public android.telecom.CallIdentification.Builder setDetails(@Nullable CharSequence); + method @NonNull public android.telecom.CallIdentification.Builder setName(@Nullable CharSequence); + method @NonNull public android.telecom.CallIdentification.Builder setNuisanceConfidence(int); + method @NonNull public android.telecom.CallIdentification.Builder setPhoto(@Nullable android.graphics.drawable.Icon); } public abstract class CallRedirectionService extends android.app.Service { @@ -41890,8 +41890,8 @@ package android.telecom { method public android.telecom.PhoneAccount getPhoneAccount(android.telecom.PhoneAccountHandle); method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.List<android.telecom.PhoneAccountHandle> getSelfManagedPhoneAccounts(); method public android.telecom.PhoneAccountHandle getSimCallManager(); - method public String getSystemDialerPackage(); - method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public android.telecom.PhoneAccountHandle getUserSelectedOutgoingPhoneAccount(); + method @Nullable public String getSystemDialerPackage(); + method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @Nullable public android.telecom.PhoneAccountHandle getUserSelectedOutgoingPhoneAccount(); method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVoiceMailNumber(android.telecom.PhoneAccountHandle); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handleMmi(String); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handleMmi(String, android.telecom.PhoneAccountHandle); diff --git a/api/system-current.txt b/api/system-current.txt index 41d8eea73013..83fff9213c87 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -5491,8 +5491,8 @@ package android.telecom { method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public java.util.List<android.telecom.PhoneAccountHandle> getPhoneAccountsSupportingScheme(String); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean isInEmergencyCall(); method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRinging(); - method @Deprecated @RequiresPermission(allOf={android.Manifest.permission.MODIFY_PHONE_STATE, android.Manifest.permission.WRITE_SECURE_SETTINGS}) public boolean setDefaultDialer(String); - method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUserSelectedOutgoingPhoneAccount(android.telecom.PhoneAccountHandle); + method @Deprecated @RequiresPermission(allOf={android.Manifest.permission.MODIFY_PHONE_STATE, android.Manifest.permission.WRITE_SECURE_SETTINGS}) public boolean setDefaultDialer(@Nullable String); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUserSelectedOutgoingPhoneAccount(@Nullable android.telecom.PhoneAccountHandle); field public static final String EXTRA_CALL_BACK_INTENT = "android.telecom.extra.CALL_BACK_INTENT"; field public static final String EXTRA_CLEAR_MISSED_CALLS_INTENT = "android.telecom.extra.CLEAR_MISSED_CALLS_INTENT"; field public static final String EXTRA_CONNECTION_SERVICE = "android.telecom.extra.CONNECTION_SERVICE"; diff --git a/api/test-current.txt b/api/test-current.txt index 271f7cbfa823..293b7f96a443 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -1458,7 +1458,7 @@ package android.telecom { public class TelecomManager { method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public int getCurrentTtyMode(); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean isInEmergencyCall(); - method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUserSelectedOutgoingPhoneAccount(android.telecom.PhoneAccountHandle); + method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUserSelectedOutgoingPhoneAccount(@Nullable android.telecom.PhoneAccountHandle); field public static final int TTY_MODE_FULL = 1; // 0x1 field public static final int TTY_MODE_HCO = 2; // 0x2 field public static final int TTY_MODE_OFF = 0; // 0x0 diff --git a/telecomm/java/android/telecom/CallIdentification.java b/telecomm/java/android/telecom/CallIdentification.java index cde7f608fa6a..fffc1239a315 100644 --- a/telecomm/java/android/telecom/CallIdentification.java +++ b/telecomm/java/android/telecom/CallIdentification.java @@ -44,7 +44,7 @@ public final class CallIdentification implements Parcelable { * A {@link CallScreeningService} uses this class to create new instances of * {@link CallIdentification} for a screened call. */ - public static class Builder { + public final static class Builder { private CharSequence mName; private CharSequence mDescription; private CharSequence mDetails; @@ -67,7 +67,7 @@ public final class CallIdentification implements Parcelable { * @param callIdAppName The app name. * @hide */ - public Builder(String callIdPackageName, CharSequence callIdAppName) { + public Builder(@NonNull String callIdPackageName, @NonNull CharSequence callIdAppName) { mPackageName = callIdPackageName; mAppName = callIdAppName; } @@ -80,7 +80,7 @@ public final class CallIdentification implements Parcelable { * @param name The name associated with the call, or {@code null} if none is provided. * @return Builder instance. */ - public Builder setName(@Nullable CharSequence name) { + public @NonNull Builder setName(@Nullable CharSequence name) { mName = name; return this; } @@ -97,7 +97,7 @@ public final class CallIdentification implements Parcelable { * @param description The call description, or {@code null} if none is provided. * @return Builder instance. */ - public Builder setDescription(@Nullable CharSequence description) { + public @NonNull Builder setDescription(@Nullable CharSequence description) { mDescription = description; return this; } @@ -114,7 +114,8 @@ public final class CallIdentification implements Parcelable { * @param details The call details, or {@code null} if none is provided. * @return Builder instance. */ - public Builder setDetails(@Nullable CharSequence details) { + + public @NonNull Builder setDetails(@Nullable CharSequence details) { mDetails = details; return this; } @@ -127,7 +128,7 @@ public final class CallIdentification implements Parcelable { * @param photo The photo associated with the call, or {@code null} if none was provided. * @return Builder instance. */ - public Builder setPhoto(@Nullable Icon photo) { + public @NonNull Builder setPhoto(@Nullable Icon photo) { mPhoto = photo; return this; } @@ -141,7 +142,7 @@ public final class CallIdentification implements Parcelable { * @param nuisanceConfidence The nuisance confidence. * @return The builder. */ - public Builder setNuisanceConfidence(@NuisanceConfidence int nuisanceConfidence) { + public @NonNull Builder setNuisanceConfidence(@NuisanceConfidence int nuisanceConfidence) { mNuisanceConfidence = nuisanceConfidence; return this; } @@ -152,7 +153,7 @@ public final class CallIdentification implements Parcelable { * * @return {@link CallIdentification} instance. */ - public CallIdentification build() { + public @NonNull 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 e655e4f4da9d..84b223826c45 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -17,6 +17,7 @@ package android.telecom; 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; @@ -809,10 +810,11 @@ public class TelecomManager { * <p> * The default dialer has access to use this method. * - * @return The user outgoing phone account selected by the user. + * @return The user outgoing phone account selected by the user, or {@code null} if there is no + * user selected outgoing {@link PhoneAccountHandle}. */ @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) - public PhoneAccountHandle getUserSelectedOutgoingPhoneAccount() { + public @Nullable PhoneAccountHandle getUserSelectedOutgoingPhoneAccount() { try { if (isServiceConnected()) { return getTelecomService().getUserSelectedOutgoingPhoneAccount( @@ -828,13 +830,14 @@ public class TelecomManager { * 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. + * 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). * @hide */ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @TestApi @SystemApi - public void setUserSelectedOutgoingPhoneAccount(PhoneAccountHandle accountHandle) { + public void setUserSelectedOutgoingPhoneAccount(@Nullable PhoneAccountHandle accountHandle) { try { if (isServiceConnected()) { getTelecomService().setUserSelectedOutgoingPhoneAccount(accountHandle); @@ -1201,7 +1204,8 @@ public class TelecomManager { /** * Used to set the default dialer package. * - * @param packageName to set the default dialer to. + * @param packageName to set the default dialer to, or {@code null} if the system provided + * dialer should be used instead. * * @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 @@ -1218,7 +1222,7 @@ public class TelecomManager { @RequiresPermission(allOf = { android.Manifest.permission.MODIFY_PHONE_STATE, android.Manifest.permission.WRITE_SECURE_SETTINGS}) - public boolean setDefaultDialer(String packageName) { + public boolean setDefaultDialer(@Nullable String packageName) { try { if (isServiceConnected()) { return getTelecomService().setDefaultDialer(packageName); @@ -1232,9 +1236,10 @@ public class TelecomManager { /** * Determines the package name of the system-provided default phone app. * - * @return package name for the system dialer package or null if no system dialer is preloaded. + * @return package name for the system dialer package or {@code null} if no system dialer is + * preloaded. */ - public String getSystemDialerPackage() { + public @Nullable String getSystemDialerPackage() { try { if (isServiceConnected()) { return getTelecomService().getSystemDialerPackage(); |