Update docs to better document PhoneAccountHandle

Warns developers to not create PhoneAccountHandles with null
arguments. If they do, a log warning is printed, reminding them that the
APIs should not be used in this manner.

Bug: 26684527
Change-Id: I03895cac9d732ee618649d38176d48620f705a1b
diff --git a/telecomm/java/android/telecom/PhoneAccountHandle.java b/telecomm/java/android/telecom/PhoneAccountHandle.java
index 6dc6e9c..77b510d 100644
--- a/telecomm/java/android/telecom/PhoneAccountHandle.java
+++ b/telecomm/java/android/telecom/PhoneAccountHandle.java
@@ -16,6 +16,7 @@
 
 package android.telecom;
 
+import android.annotation.NonNull;
 import android.content.ComponentName;
 import android.os.Parcel;
 import android.os.Parcelable;
@@ -33,6 +34,9 @@
  *      component name.</li>
  * </ul>
  *
+ * Note: This Class requires a non-null {@link ComponentName} and {@link UserHandle} to operate
+ * properly. Passing in invalid parameters will generate a log warning.
+ *
  * See {@link PhoneAccount}, {@link TelecomManager}.
  */
 public final class PhoneAccountHandle implements Parcelable {
@@ -41,15 +45,16 @@
     private final UserHandle mUserHandle;
 
     public PhoneAccountHandle(
-            ComponentName componentName,
-            String id) {
+            @NonNull ComponentName componentName,
+            @NonNull String id) {
         this(componentName, id, Process.myUserHandle());
     }
 
     public PhoneAccountHandle(
-            ComponentName componentName,
-            String id,
-            UserHandle userHandle) {
+            @NonNull ComponentName componentName,
+            @NonNull String id,
+            @NonNull UserHandle userHandle) {
+        checkParameters(componentName, userHandle);
         mComponentName = componentName;
         mId = id;
         mUserHandle = userHandle;
@@ -136,6 +141,17 @@
         mUserHandle.writeToParcel(out, flags);
     }
 
+    private void checkParameters(ComponentName componentName, UserHandle userHandle) {
+        if(componentName == null) {
+            android.util.Log.w("PhoneAccountHandle", new Exception("PhoneAccountHandle has " +
+                    "been created with null ComponentName!"));
+        }
+        if(userHandle == null) {
+            android.util.Log.w("PhoneAccountHandle", new Exception("PhoneAccountHandle has " +
+                    "been created with null UserHandle!"));
+        }
+    }
+
     public static final Creator<PhoneAccountHandle> CREATOR = new Creator<PhoneAccountHandle>() {
         @Override
         public PhoneAccountHandle createFromParcel(Parcel in) {