Merge "Fix droiddoc when OUT_DIR is an absolute path"
diff --git a/core/java/android/net/MacAddress.java b/core/java/android/net/MacAddress.java
index f6a69ba..441fad8 100644
--- a/core/java/android/net/MacAddress.java
+++ b/core/java/android/net/MacAddress.java
@@ -16,17 +16,23 @@
 
 package android.net;
 
+import android.annotation.IntDef;
 import android.os.Parcel;
 import android.os.Parcelable;
 
 import com.android.internal.util.BitUtils;
+import com.android.internal.util.Preconditions;
 
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
 import java.util.Arrays;
 import java.util.Random;
-import java.util.StringJoiner;
 
 /**
- * Represents a mac address.
+ * Representation of a MAC address.
+ *
+ * This class only supports 48 bits long addresses and does not support 64 bits long addresses.
+ * Instances of this class are immutable.
  *
  * @hide
  */
@@ -35,76 +41,102 @@
     private static final int ETHER_ADDR_LEN = 6;
     private static final byte[] ETHER_ADDR_BROADCAST = addr(0xff, 0xff, 0xff, 0xff, 0xff, 0xff);
 
-    /** The broadcast mac address.  */
-    public static final MacAddress BROADCAST_ADDRESS = new MacAddress(ETHER_ADDR_BROADCAST);
+    /**
+     * The MacAddress representing the unique broadcast MAC address.
+     */
+    public static final MacAddress BROADCAST_ADDRESS = MacAddress.fromBytes(ETHER_ADDR_BROADCAST);
 
-    /** The zero mac address. */
+    /**
+     * The MacAddress zero MAC address.
+     * @hide
+     */
     public static final MacAddress ALL_ZEROS_ADDRESS = new MacAddress(0);
 
-    /** Represents categories of mac addresses. */
-    public enum MacAddressType {
-        UNICAST,
-        MULTICAST,
-        BROADCAST;
-    }
+    /** @hide */
+    @Retention(RetentionPolicy.SOURCE)
+    @IntDef(prefix = { "TYPE_" }, value = {
+            TYPE_UNKNOWN,
+            TYPE_UNICAST,
+            TYPE_MULTICAST,
+            TYPE_BROADCAST,
+    })
+    public @interface MacAddressType { }
 
-    private static final long VALID_LONG_MASK = BROADCAST_ADDRESS.mAddr;
-    private static final long LOCALLY_ASSIGNED_MASK = new MacAddress("2:0:0:0:0:0").mAddr;
-    private static final long MULTICAST_MASK = new MacAddress("1:0:0:0:0:0").mAddr;
-    private static final long OUI_MASK = new MacAddress("ff:ff:ff:0:0:0").mAddr;
-    private static final long NIC_MASK = new MacAddress("0:0:0:ff:ff:ff").mAddr;
-    private static final MacAddress BASE_ANDROID_MAC = new MacAddress("da:a1:19:0:0:0");
+    /** Indicates a MAC address of unknown type. */
+    public static final int TYPE_UNKNOWN = 0;
+    /** Indicates a MAC address is a unicast address. */
+    public static final int TYPE_UNICAST = 1;
+    /** Indicates a MAC address is a multicast address. */
+    public static final int TYPE_MULTICAST = 2;
+    /** Indicates a MAC address is the broadcast address. */
+    public static final int TYPE_BROADCAST = 3;
 
-    // Internal representation of the mac address as a single 8 byte long.
+    private static final long VALID_LONG_MASK = (1L << 48) - 1;
+    private static final long LOCALLY_ASSIGNED_MASK = MacAddress.fromString("2:0:0:0:0:0").mAddr;
+    private static final long MULTICAST_MASK = MacAddress.fromString("1:0:0:0:0:0").mAddr;
+    private static final long OUI_MASK = MacAddress.fromString("ff:ff:ff:0:0:0").mAddr;
+    private static final long NIC_MASK = MacAddress.fromString("0:0:0:ff:ff:ff").mAddr;
+    private static final MacAddress BASE_GOOGLE_MAC = MacAddress.fromString("da:a1:19:0:0:0");
+
+    // Internal representation of the MAC address as a single 8 byte long.
     // The encoding scheme sets the two most significant bytes to 0. The 6 bytes of the
-    // mac address are encoded in the 6 least significant bytes of the long, where the first
+    // MAC address are encoded in the 6 least significant bytes of the long, where the first
     // byte of the array is mapped to the 3rd highest logical byte of the long, the second
     // byte of the array is mapped to the 4th highest logical byte of the long, and so on.
     private final long mAddr;
 
     private MacAddress(long addr) {
-        mAddr = addr;
+        mAddr = (VALID_LONG_MASK & addr);
     }
 
-    /** Creates a MacAddress for the given byte representation. */
-    public MacAddress(byte[] addr) {
-        this(longAddrFromByteAddr(addr));
-    }
-
-    /** Creates a MacAddress for the given string representation. */
-    public MacAddress(String addr) {
-        this(longAddrFromByteAddr(byteAddrFromStringAddr(addr)));
-    }
-
-    /** Returns the MacAddressType of this MacAddress. */
-    public MacAddressType addressType() {
+    /**
+     * Returns the type of this address.
+     *
+     * @return the int constant representing the MAC address type of this MacAddress.
+     */
+    public @MacAddressType int addressType() {
         if (equals(BROADCAST_ADDRESS)) {
-            return MacAddressType.BROADCAST;
+            return TYPE_BROADCAST;
         }
         if (isMulticastAddress()) {
-            return MacAddressType.MULTICAST;
+            return TYPE_MULTICAST;
         }
-        return MacAddressType.UNICAST;
+        return TYPE_UNICAST;
     }
 
-    /** Returns true if this MacAddress corresponds to a multicast address. */
+    /**
+     * @return true if this MacAddress is a multicast address.
+     * @hide
+     */
     public boolean isMulticastAddress() {
         return (mAddr & MULTICAST_MASK) != 0;
     }
 
-    /** Returns true if this MacAddress corresponds to a locally assigned address. */
+    /**
+     * @return true if this MacAddress is a locally assigned address.
+     */
     public boolean isLocallyAssigned() {
         return (mAddr & LOCALLY_ASSIGNED_MASK) != 0;
     }
 
-    /** Returns a byte array representation of this MacAddress. */
+    /**
+     * @return a byte array representation of this MacAddress.
+     */
     public byte[] toByteArray() {
         return byteAddrFromLongAddr(mAddr);
     }
 
     @Override
     public String toString() {
-        return stringAddrFromByteAddr(byteAddrFromLongAddr(mAddr));
+        return stringAddrFromLongAddr(mAddr);
+    }
+
+    /**
+     * @return a String representation of the OUI part of this MacAddres,
+     * with the lower 3 bytes constituting the NIC part replaced with 0.
+     */
+    public String toSafeString() {
+        return stringAddrFromLongAddr(mAddr & OUI_MASK);
     }
 
     @Override
@@ -138,27 +170,50 @@
                 }
             };
 
-    /** Return true if the given byte array is not null and has the length of a mac address. */
+    /**
+     * Returns true if the given byte array is an valid MAC address.
+     * A valid byte array representation for a MacAddress is a non-null array of length 6.
+     *
+     * @param addr a byte array.
+     * @return true if the given byte array is not null and has the length of a MAC address.
+     *
+     * @hide
+     */
     public static boolean isMacAddress(byte[] addr) {
         return addr != null && addr.length == ETHER_ADDR_LEN;
     }
 
     /**
-     * Return the MacAddressType of the mac address represented by the given byte array,
-     * or null if the given byte array does not represent an mac address.
+     * Returns the MAC address type of the MAC address represented by the given byte array,
+     * or null if the given byte array does not represent a MAC address.
+     * A valid byte array representation for a MacAddress is a non-null array of length 6.
+     *
+     * @param addr a byte array representing a MAC address.
+     * @return the int constant representing the MAC address type of the MAC address represented
+     * by the given byte array, or type UNKNOWN if the byte array is not a valid MAC address.
+     *
+     * @hide
      */
-    public static MacAddressType macAddressType(byte[] addr) {
+    public static int macAddressType(byte[] addr) {
         if (!isMacAddress(addr)) {
-            return null;
+            return TYPE_UNKNOWN;
         }
-        return new MacAddress(addr).addressType();
+        return MacAddress.fromBytes(addr).addressType();
     }
 
-    /** DOCME */
+    /**
+     * Converts a String representation of a MAC address to a byte array representation.
+     * A valid String representation for a MacAddress is a series of 6 values in the
+     * range [0,ff] printed in hexadecimal and joined by ':' characters.
+     *
+     * @param addr a String representation of a MAC address.
+     * @return the byte representation of the MAC address.
+     * @throws IllegalArgumentException if the given String is not a valid representation.
+     *
+     * @hide
+     */
     public static byte[] byteAddrFromStringAddr(String addr) {
-        if (addr == null) {
-            throw new IllegalArgumentException("cannot convert the null String");
-        }
+        Preconditions.checkNotNull(addr);
         String[] parts = addr.split(":");
         if (parts.length != ETHER_ADDR_LEN) {
             throw new IllegalArgumentException(addr + " was not a valid MAC address");
@@ -174,20 +229,26 @@
         return bytes;
     }
 
-    /** DOCME */
+    /**
+     * Converts a byte array representation of a MAC address to a String representation made
+     * of 6 hexadecimal numbers in [0,ff] joined by ':' characters.
+     * A valid byte array representation for a MacAddress is a non-null array of length 6.
+     *
+     * @param addr a byte array representation of a MAC address.
+     * @return the String representation of the MAC address.
+     * @throws IllegalArgumentException if the given byte array is not a valid representation.
+     *
+     * @hide
+     */
     public static String stringAddrFromByteAddr(byte[] addr) {
         if (!isMacAddress(addr)) {
             return null;
         }
-        StringJoiner j = new StringJoiner(":");
-        for (byte b : addr) {
-            j.add(Integer.toHexString(BitUtils.uint8(b)));
-        }
-        return j.toString();
+        return String.format("%02x:%02x:%02x:%02x:%02x:%02x",
+                addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
     }
 
-    /** @hide */
-    public static byte[] byteAddrFromLongAddr(long addr) {
+    private static byte[] byteAddrFromLongAddr(long addr) {
         byte[] bytes = new byte[ETHER_ADDR_LEN];
         int index = ETHER_ADDR_LEN;
         while (index-- > 0) {
@@ -197,8 +258,8 @@
         return bytes;
     }
 
-    /** @hide */
-    public static long longAddrFromByteAddr(byte[] addr) {
+    private static long longAddrFromByteAddr(byte[] addr) {
+        Preconditions.checkNotNull(addr);
         if (!isMacAddress(addr)) {
             throw new IllegalArgumentException(
                     Arrays.toString(addr) + " was not a valid MAC address");
@@ -210,11 +271,10 @@
         return longAddr;
     }
 
-    /** @hide */
-    public static long longAddrFromStringAddr(String addr) {
-        if (addr == null) {
-            throw new IllegalArgumentException("cannot convert the null String");
-        }
+    // Internal conversion function equivalent to longAddrFromByteAddr(byteAddrFromStringAddr(addr))
+    // that avoids the allocation of an intermediary byte[].
+    private static long longAddrFromStringAddr(String addr) {
+        Preconditions.checkNotNull(addr);
         String[] parts = addr.split(":");
         if (parts.length != ETHER_ADDR_LEN) {
             throw new IllegalArgumentException(addr + " was not a valid MAC address");
@@ -231,32 +291,74 @@
         return longAddr;
     }
 
-    /** @hide */
-    public static String stringAddrFromLongAddr(long addr) {
-        addr = Long.reverseBytes(addr) >> 16;
-        StringJoiner j = new StringJoiner(":");
-        for (int i = 0; i < ETHER_ADDR_LEN; i++) {
-            j.add(Integer.toHexString((byte) addr));
-            addr = addr >> 8;
-        }
-        return j.toString();
+    // Internal conversion function equivalent to stringAddrFromByteAddr(byteAddrFromLongAddr(addr))
+    // that avoids the allocation of an intermediary byte[].
+    private static String stringAddrFromLongAddr(long addr) {
+        return String.format("%02x:%02x:%02x:%02x:%02x:%02x",
+                (addr >> 40) & 0xff,
+                (addr >> 32) & 0xff,
+                (addr >> 24) & 0xff,
+                (addr >> 16) & 0xff,
+                (addr >> 8) & 0xff,
+                addr & 0xff);
     }
 
     /**
-     * Returns a randomely generated mac address with the Android OUI value "DA-A1-19".
-     * The locally assigned bit is always set to 1.
+     * Creates a MacAddress from the given String representation. A valid String representation
+     * for a MacAddress is a series of 6 values in the range [0,ff] printed in hexadecimal
+     * and joined by ':' characters.
+     *
+     * @param addr a String representation of a MAC address.
+     * @return the MacAddress corresponding to the given String representation.
+     * @throws IllegalArgumentException if the given String is not a valid representation.
      */
-    public static MacAddress getRandomAddress() {
-        return getRandomAddress(BASE_ANDROID_MAC, new Random());
+    public static MacAddress fromString(String addr) {
+        return new MacAddress(longAddrFromStringAddr(addr));
     }
 
     /**
-     * Returns a randomely generated mac address using the given Random object and the same
-     * OUI values as the given MacAddress. The locally assigned bit is always set to 1.
+     * Creates a MacAddress from the given byte array representation.
+     * A valid byte array representation for a MacAddress is a non-null array of length 6.
+     *
+     * @param addr a byte array representation of a MAC address.
+     * @return the MacAddress corresponding to the given byte array representation.
+     * @throws IllegalArgumentException if the given byte array is not a valid representation.
      */
-    public static MacAddress getRandomAddress(MacAddress base, Random r) {
-        long longAddr = (base.mAddr & OUI_MASK) | (NIC_MASK & r.nextLong()) | LOCALLY_ASSIGNED_MASK;
-        return new MacAddress(longAddr);
+    public static MacAddress fromBytes(byte[] addr) {
+        return new MacAddress(longAddrFromByteAddr(addr));
+    }
+
+    /**
+     * Returns a generated MAC address whose 24 least significant bits constituting the
+     * NIC part of the address are randomly selected.
+     *
+     * The locally assigned bit is always set to 1. The multicast bit is always set to 0.
+     *
+     * @return a random locally assigned MacAddress.
+     *
+     * @hide
+     */
+    public static MacAddress createRandomUnicastAddress() {
+        return createRandomUnicastAddress(BASE_GOOGLE_MAC, new Random());
+    }
+
+    /**
+     * Returns a randomly generated MAC address using the given Random object and the same
+     * OUI values as the given MacAddress.
+     *
+     * The locally assigned bit is always set to 1. The multicast bit is always set to 0.
+     *
+     * @param base a base MacAddress whose OUI is used for generating the random address.
+     * @param r a standard Java Random object used for generating the random address.
+     * @return a random locally assigned MacAddress.
+     *
+     * @hide
+     */
+    public static MacAddress createRandomUnicastAddress(MacAddress base, Random r) {
+        long addr = (base.mAddr & OUI_MASK) | (NIC_MASK & r.nextLong());
+        addr = addr | LOCALLY_ASSIGNED_MASK;
+        addr = addr & ~MULTICAST_MASK;
+        return new MacAddress(addr);
     }
 
     // Convenience function for working around the lack of byte literals.
diff --git a/core/java/android/net/metrics/WakeupStats.java b/core/java/android/net/metrics/WakeupStats.java
index 23c1f20..7277ba3 100644
--- a/core/java/android/net/metrics/WakeupStats.java
+++ b/core/java/android/net/metrics/WakeupStats.java
@@ -16,6 +16,7 @@
 
 package android.net.metrics;
 
+import android.net.MacAddress;
 import android.os.Process;
 import android.os.SystemClock;
 import android.util.SparseIntArray;
@@ -80,13 +81,13 @@
         }
 
         switch (ev.dstHwAddr.addressType()) {
-            case UNICAST:
+            case MacAddress.TYPE_UNICAST:
                 l2UnicastCount++;
                 break;
-            case MULTICAST:
+            case MacAddress.TYPE_MULTICAST:
                 l2MulticastCount++;
                 break;
-            case BROADCAST:
+            case MacAddress.TYPE_BROADCAST:
                 l2BroadcastCount++;
                 break;
             default:
diff --git a/core/java/android/print/IPrintClient.aidl b/core/java/android/print/IPrintClient.aidl
deleted file mode 100644
index 3f39d08..0000000
--- a/core/java/android/print/IPrintClient.aidl
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.print;
-
-import android.content.IntentSender;
-
-/**
- * Interface for communication with a printing app.
- *
- * @see android.print.IPrintClientCallback
- *
- * @hide
- */
-oneway interface IPrintClient {
-    void startPrintJobConfigActivity(in IntentSender intent);
-}
diff --git a/core/java/android/service/autofill/IAuthenticationCallback.aidl b/core/java/android/service/autofill/IAuthenticationCallback.aidl
deleted file mode 100644
index 36b989d..0000000
--- a/core/java/android/service/autofill/IAuthenticationCallback.aidl
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.view.autofill;
-
-import android.view.autofill.Dataset;
-import android.service.autofill.FillResponse;
-
-/**
- * Callback for delivering authentication result.
- *
- * {@hide}
- */
-interface IAutoFillAuthCallback {
-    void onSuccessForDataset(in Dataset dataset);
-    void onSuccessForFillResponse(in FillResponse response);
-    void onFailure(CharSequence message);
-}
diff --git a/core/java/android/service/carrier/CarrierService.java b/core/java/android/service/carrier/CarrierService.java
index 813acc2..2707f14 100644
--- a/core/java/android/service/carrier/CarrierService.java
+++ b/core/java/android/service/carrier/CarrierService.java
@@ -17,10 +17,13 @@
 import android.annotation.CallSuper;
 import android.app.Service;
 import android.content.Intent;
+import android.os.Bundle;
 import android.os.IBinder;
 import android.os.PersistableBundle;
 import android.os.RemoteException;
+import android.os.ResultReceiver;
 import android.os.ServiceManager;
+import android.util.Log;
 
 import com.android.internal.telephony.ITelephonyRegistry;
 
@@ -48,6 +51,8 @@
  */
 public abstract class CarrierService extends Service {
 
+    private static final String LOG_TAG = "CarrierService";
+
     public static final String CARRIER_SERVICE_INTERFACE = "android.service.carrier.CarrierService";
 
     private static ITelephonyRegistry sRegistry;
@@ -133,11 +138,26 @@
     /**
      * A wrapper around ICarrierService that forwards calls to implementations of
      * {@link CarrierService}.
+     * @hide
      */
-    private class ICarrierServiceWrapper extends ICarrierService.Stub {
+    public class ICarrierServiceWrapper extends ICarrierService.Stub {
+        /** @hide */
+        public static final int RESULT_OK = 0;
+        /** @hide */
+        public static final int RESULT_ERROR = 1;
+        /** @hide */
+        public static final String KEY_CONFIG_BUNDLE = "config_bundle";
+
         @Override
-        public PersistableBundle getCarrierConfig(CarrierIdentifier id) {
-            return CarrierService.this.onLoadConfig(id);
+        public void getCarrierConfig(CarrierIdentifier id, ResultReceiver result) {
+            try {
+                Bundle data = new Bundle();
+                data.putParcelable(KEY_CONFIG_BUNDLE, CarrierService.this.onLoadConfig(id));
+                result.send(RESULT_OK, data);
+            } catch (Exception e) {
+                Log.e(LOG_TAG, "Error in onLoadConfig: " + e.getMessage(), e);
+                result.send(RESULT_ERROR, null);
+            }
         }
     }
 }
diff --git a/core/java/android/service/carrier/ICarrierService.aidl b/core/java/android/service/carrier/ICarrierService.aidl
index 4c87585..ac6f9614 100644
--- a/core/java/android/service/carrier/ICarrierService.aidl
+++ b/core/java/android/service/carrier/ICarrierService.aidl
@@ -17,6 +17,7 @@
 package android.service.carrier;
 
 import android.os.PersistableBundle;
+import android.os.ResultReceiver;
 import android.service.carrier.CarrierIdentifier;
 
 /**
@@ -28,5 +29,5 @@
 interface ICarrierService {
 
     /** @see android.service.carrier.CarrierService#onLoadConfig */
-    PersistableBundle getCarrierConfig(in CarrierIdentifier id);
+    oneway void getCarrierConfig(in CarrierIdentifier id, in ResultReceiver result);
 }
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index ce19a1c..e168dd8 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -951,7 +951,10 @@
                         getNetworkTypeName(networkType), "");
                 info.setDetailedState(NetworkInfo.DetailedState.DISCONNECTED, null, null);
                 info.setIsAvailable(true);
-                state = new NetworkState(info, new LinkProperties(), new NetworkCapabilities(),
+                final NetworkCapabilities capabilities = new NetworkCapabilities();
+                capabilities.setCapability(NetworkCapabilities.NET_CAPABILITY_NOT_ROAMING,
+                        !info.isRoaming());
+                state = new NetworkState(info, new LinkProperties(), capabilities,
                         null, null, null);
             }
             filterNetworkStateForUid(state, uid, ignoreBlocked);
diff --git a/services/core/java/com/android/server/connectivity/NetdEventListenerService.java b/services/core/java/com/android/server/connectivity/NetdEventListenerService.java
index 6f2d77f..25b52da 100644
--- a/services/core/java/com/android/server/connectivity/NetdEventListenerService.java
+++ b/services/core/java/com/android/server/connectivity/NetdEventListenerService.java
@@ -243,7 +243,7 @@
         event.timestampMs = timestampMs;
         event.uid = uid;
         event.ethertype = ethertype;
-        event.dstHwAddr = new MacAddress(dstHw);
+        event.dstHwAddr = MacAddress.fromBytes(dstHw);
         event.srcIp = srcIp;
         event.dstIp = dstIp;
         event.ipNextHeader = ipNextHeader;
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 6ddb952..4d57dc2 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -710,6 +710,14 @@
     public static final String KEY_SHOW_ICCID_IN_SIM_STATUS_BOOL = "show_iccid_in_sim_status_bool";
 
     /**
+     * Flag specifying whether signal strength is hidden in SIM Status screen,
+     * default to false.
+     * @hide
+     */
+    public static final String KEY_HIDE_SIGNAL_STRENGTH_IN_SIM_STATUS_BOOL =
+        "hide_signal_strength_in_sim_status_bool";
+
+    /**
      * Flag specifying whether an additional (client initiated) intent needs to be sent on System
      * update
      */
@@ -1743,6 +1751,7 @@
         sDefaults.putString(KEY_CARRIER_VVM_PACKAGE_NAME_STRING, "");
         sDefaults.putStringArray(KEY_CARRIER_VVM_PACKAGE_NAME_STRING_ARRAY, null);
         sDefaults.putBoolean(KEY_SHOW_ICCID_IN_SIM_STATUS_BOOL, false);
+        sDefaults.putBoolean(KEY_HIDE_SIGNAL_STRENGTH_IN_SIM_STATUS_BOOL, false);
         sDefaults.putBoolean(KEY_CI_ACTION_ON_SYS_UPDATE_BOOL, false);
         sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_INTENT_STRING, "");
         sDefaults.putString(KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_STRING, "");
diff --git a/telephony/java/com/android/internal/telephony/ICallService.aidl b/telephony/java/com/android/internal/telephony/ICallService.aidl
deleted file mode 100644
index cb9b2e8..0000000
--- a/telephony/java/com/android/internal/telephony/ICallService.aidl
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.telephony;
-
-import com.android.internal.telephony.ICallServiceAdapter;
-
-/**
- * Service interface for services which would like to provide calls to be
- * managed by the system in-call UI.
- *
- * This interface provides methods that the android framework can use to deliver commands
- * for calls provided by this call service including making new calls and disconnecting
- * existing ones. A binding to ICallService implementations exists for two conditions:
- * 1) There exists one or more live calls for that call service,
- * 2) Prior to an outbound call to test if this call service is compatible with the outgoing call.
- */
-oneway interface ICallService {
-
-    /**
-     * Determines if the CallService can make calls to the handle.
-     * TODO(santoscordon): Move this method into its own service interface long term.
-     * TODO(santoscordon): Add response callback parameter.
-     */
-    void isCompatibleWith(String handle);
-
-    /**
-     * Attempts to call the relevant party using the specified handle, be it a phone number,
-     * SIP address, or some other kind of user ID.  Note that the set of handle types is
-     * dynamically extensible since call providers should be able to implement arbitrary
-     * handle-calling systems.  See {@link #isCompatibleWith}.
-     * TODO(santoscordon): Should this have a response attached to it to ensure that the call
-     * service actually plans to make the call?
-     */
-    void call(String handle);
-
-    /**
-     * Disconnects the call identified by callId.
-     */
-    void disconnect(String callId);
-
-    /**
-     * Sets an implementation of ICallServiceAdapter which the call service can use to add new calls
-     * and communicate state changes of existing calls. This is the first method that is called
-     * after a the framework binds to the call service.
-     */
-    void setCallServiceAdapter(ICallServiceAdapter callServiceAdapter);
-}
diff --git a/telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl b/telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl
deleted file mode 100644
index bc900f0..0000000
--- a/telephony/java/com/android/internal/telephony/ICallServiceAdapter.aidl
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.telephony;
-
-import com.android.internal.telephony.CallInfo;
-
-/**
- * Provides methods for ICallService implementations to interact with the system phone app.
- */
-oneway interface ICallServiceAdapter {
-
-    /**
-     * Retrieves a new unique call id for use with newOutgoingCall and newIncomingCall.
-     */
-    void getNextCallId(/* TODO(santoscordon): Needs response object */);
-
-    /**
-     * Tells CallsManager of a new incoming call.
-     */
-    void newIncomingCall(String callId, in CallInfo info);
-
-    /**
-     * Tells CallsManager of a new outgoing call.
-     */
-    void newOutgoingCall(String callId, in CallInfo info);
-
-    /**
-     * Sets a call's state to active (e.g., an ongoing call where two parties can actively
-     * communicate).
-     */
-    void setActive(String callId);
-
-    /**
-     * Sets a call's state to ringing (e.g., an inbound ringing call).
-     */
-    void setRinging(String callId);
-
-    /**
-     * Sets a call's state to dialing (e.g., dialing an outbound call).
-     */
-    void setDialing(String callId);
-
-    /**
-     * Sets a call's state to disconnected.
-     */
-    void setDisconnected(String callId);
-}
diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl
index 644ad49..5e015e0 100755
--- a/telephony/java/com/android/internal/telephony/ISub.aidl
+++ b/telephony/java/com/android/internal/telephony/ISub.aidl
@@ -18,7 +18,6 @@
 
 import android.app.PendingIntent;
 import android.telephony.SubscriptionInfo;
-import com.android.internal.telephony.ISubscriptionListener;
 
 interface ISub {
     /**
diff --git a/telephony/java/com/android/internal/telephony/ISubscriptionListener.aidl b/telephony/java/com/android/internal/telephony/ISubscriptionListener.aidl
deleted file mode 100644
index 4ccdea5..0000000
--- a/telephony/java/com/android/internal/telephony/ISubscriptionListener.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.internal.telephony;
-
-import android.telephony.SubscriptionInfo;
-
-oneway interface ISubscriptionListener {
-    void onSubscriptionInfoChanged();
-}
-
diff --git a/tests/net/java/android/net/MacAddressTest.java b/tests/net/java/android/net/MacAddressTest.java
index fcbb9da..772ff8d 100644
--- a/tests/net/java/android/net/MacAddressTest.java
+++ b/tests/net/java/android/net/MacAddressTest.java
@@ -21,7 +21,6 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.fail;
 
-import android.net.MacAddress.MacAddressType;
 import android.support.test.filters.SmallTest;
 import android.support.test.runner.AndroidJUnit4;
 
@@ -37,11 +36,11 @@
 
     static class AddrTypeTestCase {
         byte[] addr;
-        MacAddressType expected;
+        int expectedType;
 
-        static AddrTypeTestCase of(MacAddressType expected, int... addr) {
+        static AddrTypeTestCase of(int expectedType, int... addr) {
             AddrTypeTestCase t = new AddrTypeTestCase();
-            t.expected = expected;
+            t.expectedType = expectedType;
             t.addr = toByteArray(addr);
             return t;
         }
@@ -50,41 +49,73 @@
     @Test
     public void testMacAddrTypes() {
         AddrTypeTestCase[] testcases = {
-            AddrTypeTestCase.of(null),
-            AddrTypeTestCase.of(null, 0),
-            AddrTypeTestCase.of(null, 1, 2, 3, 4, 5),
-            AddrTypeTestCase.of(null, 1, 2, 3, 4, 5, 6, 7),
-            AddrTypeTestCase.of(MacAddressType.UNICAST, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0),
-            AddrTypeTestCase.of(MacAddressType.BROADCAST, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
-            AddrTypeTestCase.of(MacAddressType.MULTICAST, 1, 2, 3, 4, 5, 6),
-            AddrTypeTestCase.of(MacAddressType.MULTICAST, 11, 22, 33, 44, 55, 66),
-            AddrTypeTestCase.of(MacAddressType.MULTICAST, 33, 33, 0xaa, 0xbb, 0xcc, 0xdd)
+            AddrTypeTestCase.of(MacAddress.TYPE_UNKNOWN),
+            AddrTypeTestCase.of(MacAddress.TYPE_UNKNOWN, 0),
+            AddrTypeTestCase.of(MacAddress.TYPE_UNKNOWN, 1, 2, 3, 4, 5),
+            AddrTypeTestCase.of(MacAddress.TYPE_UNKNOWN, 1, 2, 3, 4, 5, 6, 7),
+            AddrTypeTestCase.of(MacAddress.TYPE_UNICAST, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0),
+            AddrTypeTestCase.of(MacAddress.TYPE_BROADCAST, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff),
+            AddrTypeTestCase.of(MacAddress.TYPE_MULTICAST, 1, 2, 3, 4, 5, 6),
+            AddrTypeTestCase.of(MacAddress.TYPE_MULTICAST, 11, 22, 33, 44, 55, 66),
+            AddrTypeTestCase.of(MacAddress.TYPE_MULTICAST, 33, 33, 0xaa, 0xbb, 0xcc, 0xdd)
         };
 
         for (AddrTypeTestCase t : testcases) {
-            MacAddressType got = MacAddress.macAddressType(t.addr);
+            int got = MacAddress.macAddressType(t.addr);
             String msg = String.format("expected type of %s to be %s, but got %s",
-                    Arrays.toString(t.addr), t.expected, got);
-            assertEquals(msg, t.expected, got);
+                    Arrays.toString(t.addr), t.expectedType, got);
+            assertEquals(msg, t.expectedType, got);
 
-            if (got != null) {
-                assertEquals(got, new MacAddress(t.addr).addressType());
+            if (got != MacAddress.TYPE_UNKNOWN) {
+                assertEquals(got, MacAddress.fromBytes(t.addr).addressType());
             }
         }
     }
 
     @Test
+    public void testToSafeString() {
+        String[][] macs = {
+            {"07:00:d3:56:8a:c4", "07:00:d3:00:00:00"},
+            {"33:33:aa:bb:cc:dd", "33:33:aa:00:00:00"},
+            {"06:00:00:00:00:00", "06:00:00:00:00:00"},
+            {"07:00:d3:56:8a:c4", "07:00:d3:00:00:00"}
+        };
+
+        for (String[] pair : macs) {
+            String mac = pair[0];
+            String expected = pair[1];
+            assertEquals(expected, MacAddress.fromString(mac).toSafeString());
+        }
+    }
+
+    @Test
+    public void testHexPaddingWhenPrinting() {
+        String[] macs = {
+            "07:00:d3:56:8a:c4",
+            "33:33:aa:bb:cc:dd",
+            "06:00:00:00:00:00",
+            "07:00:d3:56:8a:c4"
+        };
+
+        for (String mac : macs) {
+            assertEquals(mac, MacAddress.fromString(mac).toString());
+            assertEquals(mac,
+                    MacAddress.stringAddrFromByteAddr(MacAddress.byteAddrFromStringAddr(mac)));
+        }
+    }
+
+    @Test
     public void testIsMulticastAddress() {
         MacAddress[] multicastAddresses = {
             MacAddress.BROADCAST_ADDRESS,
-            new MacAddress("07:00:d3:56:8a:c4"),
-            new MacAddress("33:33:aa:bb:cc:dd"),
+            MacAddress.fromString("07:00:d3:56:8a:c4"),
+            MacAddress.fromString("33:33:aa:bb:cc:dd"),
         };
         MacAddress[] unicastAddresses = {
             MacAddress.ALL_ZEROS_ADDRESS,
-            new MacAddress("00:01:44:55:66:77"),
-            new MacAddress("08:00:22:33:44:55"),
-            new MacAddress("06:00:00:00:00:00"),
+            MacAddress.fromString("00:01:44:55:66:77"),
+            MacAddress.fromString("08:00:22:33:44:55"),
+            MacAddress.fromString("06:00:00:00:00:00"),
         };
 
         for (MacAddress mac : multicastAddresses) {
@@ -100,13 +131,13 @@
     @Test
     public void testIsLocallyAssignedAddress() {
         MacAddress[] localAddresses = {
-            new MacAddress("06:00:00:00:00:00"),
-            new MacAddress("07:00:d3:56:8a:c4"),
-            new MacAddress("33:33:aa:bb:cc:dd"),
+            MacAddress.fromString("06:00:00:00:00:00"),
+            MacAddress.fromString("07:00:d3:56:8a:c4"),
+            MacAddress.fromString("33:33:aa:bb:cc:dd"),
         };
         MacAddress[] universalAddresses = {
-            new MacAddress("00:01:44:55:66:77"),
-            new MacAddress("08:00:22:33:44:55"),
+            MacAddress.fromString("00:01:44:55:66:77"),
+            MacAddress.fromString("08:00:22:33:44:55"),
         };
 
         for (MacAddress mac : localAddresses) {
@@ -123,13 +154,13 @@
     public void testMacAddressConversions() {
         final int iterations = 10000;
         for (int i = 0; i < iterations; i++) {
-            MacAddress mac = MacAddress.getRandomAddress();
+            MacAddress mac = MacAddress.createRandomUnicastAddress();
 
             String stringRepr = mac.toString();
             byte[] bytesRepr = mac.toByteArray();
 
-            assertEquals(mac, new MacAddress(stringRepr));
-            assertEquals(mac, new MacAddress(bytesRepr));
+            assertEquals(mac, MacAddress.fromString(stringRepr));
+            assertEquals(mac, MacAddress.fromBytes(bytesRepr));
         }
     }
 
@@ -138,7 +169,7 @@
         final int iterations = 1000;
         final String expectedAndroidOui = "da:a1:19";
         for (int i = 0; i < iterations; i++) {
-            MacAddress mac = MacAddress.getRandomAddress();
+            MacAddress mac = MacAddress.createRandomUnicastAddress();
             String stringRepr = mac.toString();
 
             assertTrue(stringRepr + " expected to be a locally assigned address",
@@ -150,13 +181,14 @@
         final Random r = new Random();
         final String anotherOui = "24:5f:78";
         final String expectedLocalOui = "26:5f:78";
-        final MacAddress base = new MacAddress(anotherOui + ":0:0:0");
+        final MacAddress base = MacAddress.fromString(anotherOui + ":0:0:0");
         for (int i = 0; i < iterations; i++) {
-            MacAddress mac = MacAddress.getRandomAddress(base, r);
+            MacAddress mac = MacAddress.createRandomUnicastAddress(base, r);
             String stringRepr = mac.toString();
 
             assertTrue(stringRepr + " expected to be a locally assigned address",
                     mac.isLocallyAssigned());
+            assertEquals(MacAddress.TYPE_UNICAST, mac.addressType());
             assertTrue(stringRepr + " expected to begin with " + expectedLocalOui,
                     stringRepr.startsWith(expectedLocalOui));
         }
@@ -165,7 +197,6 @@
     @Test
     public void testConstructorInputValidation() {
         String[] invalidStringAddresses = {
-            null,
             "",
             "abcd",
             "1:2:3:4:5",
@@ -175,14 +206,19 @@
 
         for (String s : invalidStringAddresses) {
             try {
-                MacAddress mac = new MacAddress(s);
-                fail("new MacAddress(" + s + ") should have failed, but returned " + mac);
+                MacAddress mac = MacAddress.fromString(s);
+                fail("MacAddress.fromString(" + s + ") should have failed, but returned " + mac);
             } catch (IllegalArgumentException excepted) {
             }
         }
 
+        try {
+            MacAddress mac = MacAddress.fromString(null);
+            fail("MacAddress.fromString(null) should have failed, but returned " + mac);
+        } catch (NullPointerException excepted) {
+        }
+
         byte[][] invalidBytesAddresses = {
-            null,
             {},
             {1,2,3,4,5},
             {1,2,3,4,5,6,7},
@@ -190,12 +226,18 @@
 
         for (byte[] b : invalidBytesAddresses) {
             try {
-                MacAddress mac = new MacAddress(b);
-                fail("new MacAddress(" + Arrays.toString(b)
+                MacAddress mac = MacAddress.fromBytes(b);
+                fail("MacAddress.fromBytes(" + Arrays.toString(b)
                         + ") should have failed, but returned " + mac);
             } catch (IllegalArgumentException excepted) {
             }
         }
+
+        try {
+            MacAddress mac = MacAddress.fromBytes(null);
+            fail("MacAddress.fromBytes(null) should have failed, but returned " + mac);
+        } catch (NullPointerException excepted) {
+        }
     }
 
     static byte[] toByteArray(int... in) {