Merge "Add OnNetworkActive to TaskManager and simplify locking." into lmp-preview-dev
diff --git a/Android.mk b/Android.mk
index 8f06d2d..7c01ed9 100644
--- a/Android.mk
+++ b/Android.mk
@@ -761,7 +761,7 @@
 LOCAL_DROIDDOC_OPTIONS:=\
 		$(framework_docs_LOCAL_DROIDDOC_OPTIONS) \
 		-stubs $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/android_private_stubs_current_intermediates/src \
-        -showAnnotation android.annotation.PrivateApi \
+        -showAnnotation android.annotation.SystemApi \
 		-nodocs
 
 LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk
diff --git a/api/current.txt b/api/current.txt
index e4f2b97..0f07263 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -4840,6 +4840,9 @@
     field public static final int MENU_KEYCODE = 47; // 0x2f
     field public static final java.lang.String QUERY = "query";
     field public static final java.lang.String SHORTCUT_MIME_TYPE = "vnd.android.cursor.item/vnd.android.search.suggest";
+    field public static final java.lang.String SUGGEST_COLUMN_AUDIO_CHANNEL_CONFIG = "suggest_audio_channel_config";
+    field public static final java.lang.String SUGGEST_COLUMN_CONTENT_TYPE = "suggest_content_type";
+    field public static final java.lang.String SUGGEST_COLUMN_DURATION = "suggest_duration";
     field public static final java.lang.String SUGGEST_COLUMN_FLAGS = "suggest_flags";
     field public static final java.lang.String SUGGEST_COLUMN_FORMAT = "suggest_format";
     field public static final java.lang.String SUGGEST_COLUMN_ICON_1 = "suggest_icon_1";
@@ -4848,13 +4851,22 @@
     field public static final java.lang.String SUGGEST_COLUMN_INTENT_DATA = "suggest_intent_data";
     field public static final java.lang.String SUGGEST_COLUMN_INTENT_DATA_ID = "suggest_intent_data_id";
     field public static final java.lang.String SUGGEST_COLUMN_INTENT_EXTRA_DATA = "suggest_intent_extra_data";
+    field public static final java.lang.String SUGGEST_COLUMN_IS_LIVE = "suggest_is_live";
     field public static final java.lang.String SUGGEST_COLUMN_LAST_ACCESS_HINT = "suggest_last_access_hint";
+    field public static final java.lang.String SUGGEST_COLUMN_PRODUCTION_YEAR = "suggest_production_year";
+    field public static final java.lang.String SUGGEST_COLUMN_PURCHASE_PRICE = "suggest_purchase_price";
     field public static final java.lang.String SUGGEST_COLUMN_QUERY = "suggest_intent_query";
+    field public static final java.lang.String SUGGEST_COLUMN_RATING_SCORE = "suggest_rating_score";
+    field public static final java.lang.String SUGGEST_COLUMN_RATING_STYLE = "suggest_rating_style";
+    field public static final java.lang.String SUGGEST_COLUMN_RENTAL_PRICE = "suggest_rental_price";
+    field public static final java.lang.String SUGGEST_COLUMN_RESULT_CARD_IMAGE = "suggest_result_card_image";
     field public static final java.lang.String SUGGEST_COLUMN_SHORTCUT_ID = "suggest_shortcut_id";
     field public static final java.lang.String SUGGEST_COLUMN_SPINNER_WHILE_REFRESHING = "suggest_spinner_while_refreshing";
     field public static final java.lang.String SUGGEST_COLUMN_TEXT_1 = "suggest_text_1";
     field public static final java.lang.String SUGGEST_COLUMN_TEXT_2 = "suggest_text_2";
     field public static final java.lang.String SUGGEST_COLUMN_TEXT_2_URL = "suggest_text_2_url";
+    field public static final java.lang.String SUGGEST_COLUMN_VIDEO_HEIGHT = "suggest_video_height";
+    field public static final java.lang.String SUGGEST_COLUMN_VIDEO_WIDTH = "suggest_video_width";
     field public static final java.lang.String SUGGEST_MIME_TYPE = "vnd.android.cursor.dir/vnd.android.search.suggest";
     field public static final java.lang.String SUGGEST_NEVER_MAKE_SHORTCUT = "_-1";
     field public static final java.lang.String SUGGEST_PARAMETER_LIMIT = "limit";
@@ -6994,7 +7006,6 @@
     field public static final java.lang.String DISPLAY_SERVICE = "display";
     field public static final java.lang.String DOWNLOAD_SERVICE = "download";
     field public static final java.lang.String DROPBOX_SERVICE = "dropbox";
-    field public static final java.lang.String HDMI_CONTROL_SERVICE = "hdmi_control";
     field public static final java.lang.String INPUT_METHOD_SERVICE = "input_method";
     field public static final java.lang.String INPUT_SERVICE = "input";
     field public static final java.lang.String KEYGUARD_SERVICE = "keyguard";
@@ -7388,6 +7399,7 @@
     field public static final java.lang.String ACTION_MY_PACKAGE_REPLACED = "android.intent.action.MY_PACKAGE_REPLACED";
     field public static final java.lang.String ACTION_NEW_OUTGOING_CALL = "android.intent.action.NEW_OUTGOING_CALL";
     field public static final java.lang.String ACTION_OPEN_DOCUMENT = "android.intent.action.OPEN_DOCUMENT";
+    field public static final java.lang.String ACTION_OPEN_DOCUMENT_TREE = "android.intent.action.OPEN_DOCUMENT_TREE";
     field public static final java.lang.String ACTION_PACKAGE_ADDED = "android.intent.action.PACKAGE_ADDED";
     field public static final java.lang.String ACTION_PACKAGE_CHANGED = "android.intent.action.PACKAGE_CHANGED";
     field public static final java.lang.String ACTION_PACKAGE_DATA_CLEARED = "android.intent.action.PACKAGE_DATA_CLEARED";
@@ -7402,7 +7414,6 @@
     field public static final java.lang.String ACTION_PASTE = "android.intent.action.PASTE";
     field public static final java.lang.String ACTION_PICK = "android.intent.action.PICK";
     field public static final java.lang.String ACTION_PICK_ACTIVITY = "android.intent.action.PICK_ACTIVITY";
-    field public static final java.lang.String ACTION_PICK_DIRECTORY = "android.intent.action.PICK_DIRECTORY";
     field public static final java.lang.String ACTION_POWER_CONNECTED = "android.intent.action.ACTION_POWER_CONNECTED";
     field public static final java.lang.String ACTION_POWER_DISCONNECTED = "android.intent.action.ACTION_POWER_DISCONNECTED";
     field public static final java.lang.String ACTION_POWER_USAGE_SUMMARY = "android.intent.action.POWER_USAGE_SUMMARY";
@@ -12713,180 +12724,6 @@
 
 }
 
-package android.hardware.hdmi {
-
-  public final class HdmiCec {
-    method public static java.lang.String getDefaultDeviceName(int);
-    method public static int getTypeFromAddress(int);
-    method public static boolean isValidAddress(int);
-    method public static boolean isValidType(int);
-    field public static final int ADDR_AUDIO_SYSTEM = 5; // 0x5
-    field public static final int ADDR_BROADCAST = 15; // 0xf
-    field public static final int ADDR_INVALID = -1; // 0xffffffff
-    field public static final int ADDR_PLAYBACK_1 = 4; // 0x4
-    field public static final int ADDR_PLAYBACK_2 = 8; // 0x8
-    field public static final int ADDR_PLAYBACK_3 = 11; // 0xb
-    field public static final int ADDR_RECORDER_1 = 1; // 0x1
-    field public static final int ADDR_RECORDER_2 = 2; // 0x2
-    field public static final int ADDR_RECORDER_3 = 9; // 0x9
-    field public static final int ADDR_RESERVED_1 = 12; // 0xc
-    field public static final int ADDR_RESERVED_2 = 13; // 0xd
-    field public static final int ADDR_SPECIFIC_USE = 14; // 0xe
-    field public static final int ADDR_TUNER_1 = 3; // 0x3
-    field public static final int ADDR_TUNER_2 = 6; // 0x6
-    field public static final int ADDR_TUNER_3 = 7; // 0x7
-    field public static final int ADDR_TUNER_4 = 10; // 0xa
-    field public static final int ADDR_TV = 0; // 0x0
-    field public static final int ADDR_UNREGISTERED = 15; // 0xf
-    field public static final int DEVICE_AUDIO_SYSTEM = 5; // 0x5
-    field public static final int DEVICE_INACTIVE = -1; // 0xffffffff
-    field public static final int DEVICE_PLAYBACK = 4; // 0x4
-    field public static final int DEVICE_RECORDER = 1; // 0x1
-    field public static final int DEVICE_RESERVED = 2; // 0x2
-    field public static final int DEVICE_TUNER = 3; // 0x3
-    field public static final int DEVICE_TV = 0; // 0x0
-    field public static final int MESSAGE_ABORT = 255; // 0xff
-    field public static final int MESSAGE_ACTIVE_SOURCE = 130; // 0x82
-    field public static final int MESSAGE_CEC_VERSION = 158; // 0x9e
-    field public static final int MESSAGE_CLEAR_ANALOG_TIMER = 51; // 0x33
-    field public static final int MESSAGE_CLEAR_DIGITAL_TIMER = 153; // 0x99
-    field public static final int MESSAGE_CLEAR_EXTERNAL_TIMER = 161; // 0xa1
-    field public static final int MESSAGE_DECK_CONTROL = 66; // 0x42
-    field public static final int MESSAGE_DECK_STATUS = 27; // 0x1b
-    field public static final int MESSAGE_DEVICE_VENDOR_ID = 135; // 0x87
-    field public static final int MESSAGE_FEATURE_ABORT = 0; // 0x0
-    field public static final int MESSAGE_GET_CEC_VERSION = 159; // 0x9f
-    field public static final int MESSAGE_GET_MENU_LANGUAGE = 145; // 0x91
-    field public static final int MESSAGE_GIVE_AUDIO_STATUS = 113; // 0x71
-    field public static final int MESSAGE_GIVE_DECK_STATUS = 26; // 0x1a
-    field public static final int MESSAGE_GIVE_DEVICE_POWER_STATUS = 143; // 0x8f
-    field public static final int MESSAGE_GIVE_DEVICE_VENDOR_ID = 140; // 0x8c
-    field public static final int MESSAGE_GIVE_OSD_NAME = 70; // 0x46
-    field public static final int MESSAGE_GIVE_PHYSICAL_ADDRESS = 131; // 0x83
-    field public static final int MESSAGE_GIVE_SYSTEM_AUDIO_MODE_STATUS = 125; // 0x7d
-    field public static final int MESSAGE_GIVE_TUNER_DEVICE_STATUS = 8; // 0x8
-    field public static final int MESSAGE_IMAGE_VIEW_ON = 4; // 0x4
-    field public static final int MESSAGE_INACTIVE_SOURCE = 157; // 0x9d
-    field public static final int MESSAGE_INITIATE_ARC = 192; // 0xc0
-    field public static final int MESSAGE_MENU_REQUEST = 141; // 0x8d
-    field public static final int MESSAGE_MENU_STATUS = 142; // 0x8e
-    field public static final int MESSAGE_PLAY = 65; // 0x41
-    field public static final int MESSAGE_RECORD_OFF = 11; // 0xb
-    field public static final int MESSAGE_RECORD_ON = 9; // 0x9
-    field public static final int MESSAGE_RECORD_STATUS = 10; // 0xa
-    field public static final int MESSAGE_RECORD_TV_SCREEN = 15; // 0xf
-    field public static final int MESSAGE_REPORT_ARC_INITIATED = 193; // 0xc1
-    field public static final int MESSAGE_REPORT_ARC_TERMINATED = 194; // 0xc2
-    field public static final int MESSAGE_REPORT_AUDIO_STATUS = 122; // 0x7a
-    field public static final int MESSAGE_REPORT_PHYSICAL_ADDRESS = 132; // 0x84
-    field public static final int MESSAGE_REPORT_POWER_STATUS = 144; // 0x90
-    field public static final int MESSAGE_REQUEST_ACTIVE_SOURCE = 133; // 0x85
-    field public static final int MESSAGE_REQUEST_ARC_INITIATION = 195; // 0xc3
-    field public static final int MESSAGE_REQUEST_ARC_TERMINATION = 196; // 0xc4
-    field public static final int MESSAGE_ROUTING_CHANGE = 128; // 0x80
-    field public static final int MESSAGE_ROUTING_INFORMATION = 129; // 0x81
-    field public static final int MESSAGE_SELECT_ANALOG_SERVICE = 146; // 0x92
-    field public static final int MESSAGE_SELECT_DIGITAL_SERVICE = 147; // 0x93
-    field public static final int MESSAGE_SET_ANALOG_TIMER = 52; // 0x34
-    field public static final int MESSAGE_SET_AUDIO_RATE = 154; // 0x9a
-    field public static final int MESSAGE_SET_DIGITAL_TIMER = 151; // 0x97
-    field public static final int MESSAGE_SET_EXTERNAL_TIMER = 162; // 0xa2
-    field public static final int MESSAGE_SET_MENU_LANGUAGE = 50; // 0x32
-    field public static final int MESSAGE_SET_OSD_NAME = 71; // 0x47
-    field public static final int MESSAGE_SET_OSD_STRING = 100; // 0x64
-    field public static final int MESSAGE_SET_STREAM_PATH = 134; // 0x86
-    field public static final int MESSAGE_SET_SYSTEM_AUDIO_MODE = 114; // 0x72
-    field public static final int MESSAGE_SET_TIMER_PROGRAM_TITLE = 103; // 0x67
-    field public static final int MESSAGE_STANDBY = 54; // 0x36
-    field public static final int MESSAGE_SYSTEM_AUDIO_MODE_REQUEST = 112; // 0x70
-    field public static final int MESSAGE_SYSTEM_AUDIO_MODE_STATUS = 126; // 0x7e
-    field public static final int MESSAGE_TERMINATE_ARC = 197; // 0xc5
-    field public static final int MESSAGE_TEXT_VIEW_ON = 13; // 0xd
-    field public static final int MESSAGE_TIMER_CLEARED_STATUS = 67; // 0x43
-    field public static final int MESSAGE_TIMER_STATUS = 53; // 0x35
-    field public static final int MESSAGE_TUNER_DEVICE_STATUS = 7; // 0x7
-    field public static final int MESSAGE_TUNER_STEP_DECREMENT = 6; // 0x6
-    field public static final int MESSAGE_TUNER_STEP_INCREMENT = 5; // 0x5
-    field public static final int MESSAGE_USER_CONTROL_PRESSED = 68; // 0x44
-    field public static final int MESSAGE_USER_CONTROL_RELEASED = 69; // 0x45
-    field public static final int MESSAGE_VENDOR_COMMAND = 137; // 0x89
-    field public static final int MESSAGE_VENDOR_COMMAND_WITH_ID = 160; // 0xa0
-    field public static final int MESSAGE_VENDOR_REMOTE_BUTTON_DOWN = 138; // 0x8a
-    field public static final int MESSAGE_VENDOR_REMOTE_BUTTON_UP = 139; // 0x8b
-    field public static final int POWER_STATUS_ON = 0; // 0x0
-    field public static final int POWER_STATUS_STANDBY = 1; // 0x1
-    field public static final int POWER_STATUS_TRANSIENT_TO_ON = 2; // 0x2
-    field public static final int POWER_STATUS_TRANSIENT_TO_STANDBY = 3; // 0x3
-    field public static final int POWER_STATUS_UNKNOWN = -1; // 0xffffffff
-    field public static final int RESULT_ALREADY_IN_PROGRESS = 4; // 0x4
-    field public static final int RESULT_EXCEPTION = 5; // 0x5
-    field public static final int RESULT_SOURCE_NOT_AVAILABLE = 2; // 0x2
-    field public static final int RESULT_SUCCESS = 0; // 0x0
-    field public static final int RESULT_TARGET_NOT_AVAILABLE = 3; // 0x3
-    field public static final int RESULT_TIMEOUT = 1; // 0x1
-    field public static final int UNKNOWN_VENDOR_ID = 16777215; // 0xffffff
-  }
-
-  public final class HdmiCecDeviceInfo implements android.os.Parcelable {
-    method public int describeContents();
-    method public int getDeviceType();
-    method public java.lang.String getDisplayName();
-    method public int getLogicalAddress();
-    method public int getPhysicalAddress();
-    method public int getVendorId();
-    method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator CREATOR;
-  }
-
-  public final class HdmiCecMessage implements android.os.Parcelable {
-    ctor public HdmiCecMessage(int, int, int, byte[]);
-    method public int describeContents();
-    method public int getDestination();
-    method public int getOpcode();
-    method public byte[] getParams();
-    method public int getSource();
-    method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator CREATOR;
-    field public static final byte[] EMPTY_PARAM;
-  }
-
-  public final class HdmiControlManager {
-    method public void addHotplugEventListener(android.hardware.hdmi.HdmiControlManager.HotplugEventListener);
-    method public android.hardware.hdmi.HdmiPlaybackClient getPlaybackClient();
-    method public android.hardware.hdmi.HdmiTvClient getTvClient();
-    method public void removeHotplugEventListener(android.hardware.hdmi.HdmiControlManager.HotplugEventListener);
-  }
-
-  public static abstract interface HdmiControlManager.HotplugEventListener {
-    method public abstract void onReceived(android.hardware.hdmi.HdmiHotplugEvent);
-  }
-
-  public final class HdmiHotplugEvent implements android.os.Parcelable {
-    method public int describeContents();
-    method public int getPort();
-    method public boolean isConnected();
-    method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator CREATOR;
-  }
-
-  public final class HdmiPlaybackClient {
-    method public void oneTouchPlay(android.hardware.hdmi.HdmiPlaybackClient.OneTouchPlayCallback);
-    method public void queryDisplayStatus(android.hardware.hdmi.HdmiPlaybackClient.DisplayStatusCallback);
-  }
-
-  public static abstract interface HdmiPlaybackClient.DisplayStatusCallback {
-    method public abstract void onComplete(int);
-  }
-
-  public static abstract interface HdmiPlaybackClient.OneTouchPlayCallback {
-    method public abstract void onComplete(int);
-  }
-
-  public final class HdmiTvClient {
-  }
-
-}
-
 package android.hardware.input {
 
   public final class InputManager {
@@ -23812,21 +23649,21 @@
 
   public final class DocumentsContract {
     method public static android.net.Uri buildChildDocumentsUri(java.lang.String, java.lang.String);
-    method public static android.net.Uri buildChildDocumentsViaUri(android.net.Uri, java.lang.String);
+    method public static android.net.Uri buildChildDocumentsUriUsingTree(android.net.Uri, java.lang.String);
     method public static android.net.Uri buildDocumentUri(java.lang.String, java.lang.String);
-    method public static android.net.Uri buildDocumentViaUri(android.net.Uri, java.lang.String);
+    method public static android.net.Uri buildDocumentUriUsingTree(android.net.Uri, java.lang.String);
     method public static android.net.Uri buildRecentDocumentsUri(java.lang.String, java.lang.String);
     method public static android.net.Uri buildRootUri(java.lang.String, java.lang.String);
     method public static android.net.Uri buildRootsUri(java.lang.String);
     method public static android.net.Uri buildSearchDocumentsUri(java.lang.String, java.lang.String, java.lang.String);
-    method public static android.net.Uri buildViaUri(java.lang.String, java.lang.String);
+    method public static android.net.Uri buildTreeDocumentUri(java.lang.String, java.lang.String);
     method public static android.net.Uri createDocument(android.content.ContentResolver, android.net.Uri, java.lang.String, java.lang.String);
     method public static boolean deleteDocument(android.content.ContentResolver, android.net.Uri);
     method public static java.lang.String getDocumentId(android.net.Uri);
     method public static android.graphics.Bitmap getDocumentThumbnail(android.content.ContentResolver, android.net.Uri, android.graphics.Point, android.os.CancellationSignal);
     method public static java.lang.String getRootId(android.net.Uri);
     method public static java.lang.String getSearchDocumentsQuery(android.net.Uri);
-    method public static java.lang.String getViaDocumentId(android.net.Uri);
+    method public static java.lang.String getTreeDocumentId(android.net.Uri);
     method public static boolean isDocumentUri(android.content.Context, android.net.Uri);
     method public static android.net.Uri renameDocument(android.content.ContentResolver, android.net.Uri, java.lang.String);
     field public static final java.lang.String EXTRA_ERROR = "error";
@@ -23865,7 +23702,7 @@
     field public static final java.lang.String COLUMN_TITLE = "title";
     field public static final int FLAG_LOCAL_ONLY = 2; // 0x2
     field public static final int FLAG_SUPPORTS_CREATE = 1; // 0x1
-    field public static final int FLAG_SUPPORTS_DIR_SELECTION = 16; // 0x10
+    field public static final int FLAG_SUPPORTS_IS_CHILD = 16; // 0x10
     field public static final int FLAG_SUPPORTS_RECENTS = 4; // 0x4
     field public static final int FLAG_SUPPORTS_SEARCH = 8; // 0x8
   }
diff --git a/core/java/android/animation/ObjectAnimator.java b/core/java/android/animation/ObjectAnimator.java
index 130754e..8947550 100644
--- a/core/java/android/animation/ObjectAnimator.java
+++ b/core/java/android/animation/ObjectAnimator.java
@@ -16,11 +16,14 @@
 
 package android.animation;
 
+import android.annotation.NonNull;
+import android.annotation.Nullable;
 import android.graphics.Path;
 import android.graphics.PointF;
 import android.util.Log;
 import android.util.Property;
 
+import java.lang.ref.WeakReference;
 import java.util.ArrayList;
 
 /**
@@ -41,10 +44,15 @@
  *
  */
 public final class ObjectAnimator extends ValueAnimator {
+    private static final String LOG_TAG = "ObjectAnimator";
+
     private static final boolean DBG = false;
 
-    // The target object on which the property exists, set in the constructor
-    private Object mTarget;
+    /**
+     * A weak reference to the target object on which the property exists, set
+     * in the constructor. We'll cancel the animation if this goes away.
+     */
+    private WeakReference<Object> mTarget;
 
     private String mPropertyName;
 
@@ -78,7 +86,7 @@
      *
      * @param propertyName The name of the property being animated. Should not be null.
      */
-    public void setPropertyName(String propertyName) {
+    public void setPropertyName(@NonNull String propertyName) {
         // mValues could be null if this is being constructed piecemeal. Just record the
         // propertyName to be used later when setValues() is called if so.
         if (mValues != null) {
@@ -100,7 +108,7 @@
      *
      * @param property The property being animated. Should not be null.
      */
-    public void setProperty(Property property) {
+    public void setProperty(@NonNull Property property) {
         // mValues could be null if this is being constructed piecemeal. Just record the
         // propertyName to be used later when setValues() is called if so.
         if (mValues != null) {
@@ -134,6 +142,7 @@
      * object (if there was just one) or a comma-separated list of all of the
      * names (if there are more than one).</p>
      */
+    @Nullable
     public String getPropertyName() {
         String propertyName = null;
         if (mPropertyName != null) {
@@ -176,7 +185,7 @@
      * @param propertyName The name of the property being animated.
      */
     private ObjectAnimator(Object target, String propertyName) {
-        mTarget = target;
+        setTarget(target);
         setPropertyName(propertyName);
     }
 
@@ -187,7 +196,7 @@
      * @param property The property being animated.
      */
     private <T> ObjectAnimator(T target, Property<T, ?> property) {
-        mTarget = target;
+        setTarget(target);
         setProperty(property);
     }
 
@@ -574,8 +583,9 @@
      * @param path The <code>Path</code> to animate values along.
      * @return An ObjectAnimator object that is set up to animate along <code>path</code>.
      */
+    @NonNull
     public static ObjectAnimator ofObject(Object target, String propertyName,
-            TypeConverter<PointF, ?> converter, Path path) {
+            @Nullable TypeConverter<PointF, ?> converter, Path path) {
         PropertyValuesHolder pvh = PropertyValuesHolder.ofObject(propertyName, converter, path);
         return ofPropertyValuesHolder(target, pvh);
     }
@@ -595,6 +605,7 @@
      * @param values A set of values that the animation will animate between over time.
      * @return An ObjectAnimator object that is set up to animate between the given values.
      */
+    @NonNull
     public static <T, V> ObjectAnimator ofObject(T target, Property<T, V> property,
             TypeEvaluator<V> evaluator, V... values) {
         ObjectAnimator anim = new ObjectAnimator(target, property);
@@ -622,6 +633,7 @@
      * @param values A set of values that the animation will animate between over time.
      * @return An ObjectAnimator object that is set up to animate between the given values.
      */
+    @NonNull
     public static <T, V, P> ObjectAnimator ofObject(T target, Property<T, P> property,
             TypeConverter<V, P> converter, TypeEvaluator<V> evaluator, V... values) {
         PropertyValuesHolder pvh = PropertyValuesHolder.ofObject(property, converter, evaluator,
@@ -644,8 +656,9 @@
      * @param path The <code>Path</code> to animate values along.
      * @return An ObjectAnimator object that is set up to animate along <code>path</code>.
      */
-    public static <T, V> ObjectAnimator ofObject(T target, Property<T, V> property,
-            TypeConverter<PointF, V> converter, Path path) {
+    @NonNull
+    public static <T, V> ObjectAnimator ofObject(T target, @NonNull Property<T, V> property,
+            @Nullable TypeConverter<PointF, V> converter, Path path) {
         PropertyValuesHolder pvh = PropertyValuesHolder.ofObject(property, converter, path);
         return ofPropertyValuesHolder(target, pvh);
     }
@@ -667,10 +680,11 @@
      * over time.
      * @return An ObjectAnimator object that is set up to animate between the given values.
      */
+    @NonNull
     public static ObjectAnimator ofPropertyValuesHolder(Object target,
             PropertyValuesHolder... values) {
         ObjectAnimator anim = new ObjectAnimator();
-        anim.mTarget = target;
+        anim.setTarget(target);
         anim.setValues(values);
         return anim;
     }
@@ -736,10 +750,10 @@
         mAutoCancel = cancel;
     }
 
-    private boolean hasSameTargetAndProperties(Animator anim) {
+    private boolean hasSameTargetAndProperties(@Nullable Animator anim) {
         if (anim instanceof ObjectAnimator) {
             PropertyValuesHolder[] theirValues = ((ObjectAnimator) anim).getValues();
-            if (((ObjectAnimator) anim).getTarget() == mTarget &&
+            if (((ObjectAnimator) anim).getTarget() == getTarget() &&
                     mValues.length == theirValues.length) {
                 for (int i = 0; i < mValues.length; ++i) {
                     PropertyValuesHolder pvhMine = mValues[i];
@@ -789,11 +803,11 @@
             }
         }
         if (DBG) {
-            Log.d("ObjectAnimator", "Anim target, duration: " + mTarget + ", " + getDuration());
+            Log.d(LOG_TAG, "Anim target, duration: " + getTarget() + ", " + getDuration());
             for (int i = 0; i < mValues.length; ++i) {
                 PropertyValuesHolder pvh = mValues[i];
                 ArrayList<Keyframe> keyframes = pvh.mKeyframeSet.mKeyframes;
-                Log.d("ObjectAnimator", "   Values[" + i + "]: " +
+                Log.d(LOG_TAG, "   Values[" + i + "]: " +
                     pvh.getPropertyName() + ", " + keyframes.get(0).getValue() + ", " +
                     keyframes.get(pvh.mKeyframeSet.mNumKeyframes - 1).getValue());
             }
@@ -818,9 +832,12 @@
         if (!mInitialized) {
             // mValueType may change due to setter/getter setup; do this before calling super.init(),
             // which uses mValueType to set up the default type evaluator.
-            int numValues = mValues.length;
-            for (int i = 0; i < numValues; ++i) {
-                mValues[i].setupSetterAndGetter(mTarget);
+            final Object target = getTarget();
+            if (target != null) {
+                final int numValues = mValues.length;
+                for (int i = 0; i < numValues; ++i) {
+                    mValues[i].setupSetterAndGetter(target);
+                }
             }
             super.initAnimation();
         }
@@ -836,6 +853,7 @@
      * <code>ObjectAnimator.ofInt(target, propertyName, 0, 10).setDuration(500).start()</code>.
      */
     @Override
+    @NonNull
     public ObjectAnimator setDuration(long duration) {
         super.setDuration(duration);
         return this;
@@ -847,8 +865,9 @@
      *
      * @return The object being animated
      */
+    @Nullable
     public Object getTarget() {
-        return mTarget;
+        return mTarget == null ? null : mTarget.get();
     }
 
     /**
@@ -857,10 +876,10 @@
      * @param target The object being animated
      */
     @Override
-    public void setTarget(Object target) {
-        if (mTarget != target) {
-            final Object oldTarget = mTarget;
-            mTarget = target;
+    public void setTarget(@Nullable Object target) {
+        final Object oldTarget = getTarget();
+        if (oldTarget != target) {
+            mTarget = target == null ? null : new WeakReference<Object>(target);
             if (oldTarget != null && target != null && oldTarget.getClass() == target.getClass()) {
                 return;
             }
@@ -872,18 +891,26 @@
     @Override
     public void setupStartValues() {
         initAnimation();
-        int numValues = mValues.length;
-        for (int i = 0; i < numValues; ++i) {
-            mValues[i].setupStartValue(mTarget);
+
+        final Object target = getTarget();
+        if (target != null) {
+            final int numValues = mValues.length;
+            for (int i = 0; i < numValues; ++i) {
+                mValues[i].setupStartValue(target);
+            }
         }
     }
 
     @Override
     public void setupEndValues() {
         initAnimation();
-        int numValues = mValues.length;
-        for (int i = 0; i < numValues; ++i) {
-            mValues[i].setupEndValue(mTarget);
+
+        final Object target = getTarget();
+        if (target != null) {
+            final int numValues = mValues.length;
+            for (int i = 0; i < numValues; ++i) {
+                mValues[i].setupEndValue(target);
+            }
         }
     }
 
@@ -901,10 +928,17 @@
      */
     @Override
     void animateValue(float fraction) {
+        final Object target = getTarget();
+        if (mTarget != null && target == null) {
+            // We lost the target reference, cancel and clean up.
+            cancel();
+            return;
+        }
+
         super.animateValue(fraction);
         int numValues = mValues.length;
         for (int i = 0; i < numValues; ++i) {
-            mValues[i].setAnimatedValue(mTarget);
+            mValues[i].setAnimatedValue(target);
         }
     }
 
@@ -915,9 +949,10 @@
     }
 
     @Override
+    @NonNull
     public String toString() {
         String returnVal = "ObjectAnimator@" + Integer.toHexString(hashCode()) + ", target " +
-            mTarget;
+            getTarget();
         if (mValues != null) {
             for (int i = 0; i < mValues.length; ++i) {
                 returnVal += "\n    " + mValues[i].toString();
diff --git a/core/java/android/annotation/PrivateApi.java b/core/java/android/annotation/PrivateApi.java
deleted file mode 100644
index 985eafe..0000000
--- a/core/java/android/annotation/PrivateApi.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2008 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.annotation;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Indicates an API is exposed for use by bundled applications.
- * <p>
- * These APIs are not guaranteed to remain consistent release-to-release,
- * and are not for use by apps linking against the SDK.
- * @hide
- */
-@Retention(RetentionPolicy.SOURCE)
-public @interface PrivateApi {
-}
diff --git a/core/java/android/annotation/SystemApi.java b/core/java/android/annotation/SystemApi.java
new file mode 100644
index 0000000..55028eb
--- /dev/null
+++ b/core/java/android/annotation/SystemApi.java
@@ -0,0 +1,44 @@
+/*
+ * 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 android.annotation;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PACKAGE;
+import static java.lang.annotation.ElementType.TYPE;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Indicates an API is exposed for use by bundled system applications.
+ * <p>
+ * These APIs are not guaranteed to remain consistent release-to-release,
+ * and are not for use by apps linking against the Android SDK.
+ * </p><p>
+ * This annotation should only appear on API that is already marked <pre>@hide</pre>.
+ * </p>
+ *
+ * @hide
+ */
+@Target({TYPE, FIELD, METHOD, CONSTRUCTOR, ANNOTATION_TYPE, PACKAGE})
+@Retention(RetentionPolicy.SOURCE)
+public @interface SystemApi {
+}
diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java
index 33c3409..261b15d 100644
--- a/core/java/android/app/SearchManager.java
+++ b/core/java/android/app/SearchManager.java
@@ -253,6 +253,7 @@
      * for more information on these schemes.
      */
     public final static String SUGGEST_COLUMN_ICON_1 = "suggest_icon_1";
+
     /**
      * Column name for suggestions cursor.  <i>Optional.</i>  If your cursor includes this column,
      *  then all suggestions will be provided in a format that includes space for two small icons,
@@ -269,6 +270,24 @@
      * for more information on these schemes.
      */
     public final static String SUGGEST_COLUMN_ICON_2 = "suggest_icon_2";
+
+    /**
+     * Column name for suggestions cursor.  <i>Optional.</i>  If your cursor includes this column,
+     * then the image will be displayed when forming the suggestion. The suggested dimension for
+     * the image is 270x400 px for portrait mode and 400x225 px for landscape mode. The data in the
+     * column must be a resource ID of a drawable, or a URI in one of the following formats:
+     *
+     * <ul>
+     * <li>content ({@link android.content.ContentResolver#SCHEME_CONTENT})</li>
+     * <li>android.resource ({@link android.content.ContentResolver#SCHEME_ANDROID_RESOURCE})</li>
+     * <li>file ({@link android.content.ContentResolver#SCHEME_FILE})</li>
+     * </ul>
+     *
+     * See {@link android.content.ContentResolver#openAssetFileDescriptor(Uri, String)}
+     * for more information on these schemes.
+     */
+    public final static String SUGGEST_COLUMN_RESULT_CARD_IMAGE = "suggest_result_card_image";
+
     /**
      * Column name for suggestions cursor.  <i>Optional.</i>  If this column exists <i>and</i>
      * this element exists at the given row, this is the action that will be used when
@@ -279,6 +298,7 @@
      * it from the cursor.
      */
     public final static String SUGGEST_COLUMN_INTENT_ACTION = "suggest_intent_action";
+
     /**
      * Column name for suggestions cursor.  <i>Optional.</i>  If this column exists <i>and</i>
      * this element exists at the given row, this is the data that will be used when
@@ -289,6 +309,7 @@
      * it is more efficient to specify it using XML metadata and omit it from the cursor.
      */
     public final static String SUGGEST_COLUMN_INTENT_DATA = "suggest_intent_data";
+
     /**
      * Column name for suggestions cursor.  <i>Optional.</i>  If this column exists <i>and</i>
      * this element exists at the given row, this is the data that will be used when
@@ -297,6 +318,7 @@
      * an extra under the key {@link #EXTRA_DATA_KEY}.
      */
     public final static String SUGGEST_COLUMN_INTENT_EXTRA_DATA = "suggest_intent_extra_data";
+
     /**
      * Column name for suggestions cursor.  <i>Optional.</i>  If this column exists <i>and</i>
      * this element exists at the given row, then "/" and this value will be appended to the data
@@ -304,6 +326,7 @@
      * appropriate base string.
      */
     public final static String SUGGEST_COLUMN_INTENT_DATA_ID = "suggest_intent_data_id";
+
     /**
      * Column name for suggestions cursor.  <i>Required if action is
      * {@link android.content.Intent#ACTION_SEARCH ACTION_SEARCH}, optional otherwise.</i>  If this
@@ -331,6 +354,89 @@
             "suggest_spinner_while_refreshing";
 
     /**
+     * Column name for suggestions cursor. <i>Optional.</i>  If your content is media type, you
+     * should provide this column so search app could understand more about your content. The data
+     * in the column must specify the MIME type of the content.
+     */
+    public final static String SUGGEST_COLUMN_CONTENT_TYPE = "suggest_content_type";
+
+    /**
+     * Column name for suggestions cursor. <i>Optional.</i>  If your content is media type, you
+     * should provide this column to specify whether your content is live media such as live video
+     * or live audio. The value in the column is of integer type with value of either 0 indicating
+     * non-live content or 1 indicating live content.
+     */
+    public final static String SUGGEST_COLUMN_IS_LIVE = "suggest_is_live";
+
+    /**
+     * Column name for suggestions cursor. <i>Optional.</i>  If your content is video, you should
+     * provide this column to specify the number of vertical lines. The data in the column is of
+     * integer type.
+     */
+    public final static String SUGGEST_COLUMN_VIDEO_WIDTH = "suggest_video_width";
+
+    /**
+     * Column name for suggestions cursor. <i>Optional.</i>  If your content is video, you should
+     * provide this column to specify the number of horizontal lines. The data in the column is of
+     * integer type.
+     */
+    public final static String SUGGEST_COLUMN_VIDEO_HEIGHT = "suggest_video_height";
+
+    /**
+     * Column name for suggestions cursor. <i>Optional.</i>  If your content contains audio, you
+     * should provide this column to specify the audio channel configuration. The data in the
+     * column is string with format like "channels.subchannels" such as "1.0" or "5.1".
+     */
+    public final static String SUGGEST_COLUMN_AUDIO_CHANNEL_CONFIG = "suggest_audio_channel_config";
+
+    /**
+     * Column name for suggestions cursor. <i>Optional.</i>  If your content is purchasable, you
+     * should provide this column to specify the displayable string representation of the purchase
+     * price of your content including the currency and the amount. If it's free, you should
+     * provide localized string to specify that it's free. This column can be omitted if the content
+     * is not applicable to purchase.
+     */
+    public final static String SUGGEST_COLUMN_PURCHASE_PRICE = "suggest_purchase_price";
+
+    /**
+     * Column name for suggestions cursor. <i>Optional.</i>  If your content is rentable, you
+     * should provide this column to specify the displayable string representation of the rental
+     * price of your content including the currency and the amount. If it's free, you should
+     * provide localized string to specify that it's free. This column can be ommitted if the
+     * content is not applicable to rent.
+     */
+    public final static String SUGGEST_COLUMN_RENTAL_PRICE = "suggest_rental_price";
+
+    /**
+     * Column name for suggestions cursor. <i>Optional.</i>  If your content has a rating, you
+     * should provide this column to specify the rating style of your content. The data in the
+     * column must be one of the constant values specified in {@link android.media.Rating}
+     */
+    public final static String SUGGEST_COLUMN_RATING_STYLE = "suggest_rating_style";
+
+    /**
+     * Column name for suggestions cursor. <i>Optional.</i>  If your content has a rating, you
+     * should provide this column to specify the rating score of your content. The data in the
+     * column is of float type. See {@link android.media.Rating} about valid rating scores for each
+     * rating style.
+     */
+    public final static String SUGGEST_COLUMN_RATING_SCORE = "suggest_rating_score";
+
+    /**
+     * Column name for suggestions cursor. <i>Optional.</i>  If your content is video or audio and
+     * has a known production year, you should provide this column to specify the production year
+     * of your content. The data in the column is of integer type.
+     */
+    public final static String SUGGEST_COLUMN_PRODUCTION_YEAR = "suggest_production_year";
+
+    /**
+     * Column name for suggestions cursor. <i>Optional.</i>  If your content is video or audio, you
+     * should provide this column to specify the duration of your content in milliseconds. The data
+     * in the column is of long type.
+     */
+    public final static String SUGGEST_COLUMN_DURATION = "suggest_duration";
+
+    /**
      * Column name for suggestions cursor. <i>Optional.</i> This column is used to specify
      * additional flags per item. Multiple flags can be specified.
      * <p>
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 571bb4d..9fe9bce 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -20,6 +20,7 @@
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.annotation.StringDef;
+import android.annotation.SystemApi;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
 import android.content.res.AssetManager;
@@ -2641,7 +2642,9 @@
      *
      * @see #getSystemService
      * @see android.hardware.hdmi.HdmiControlManager
+     * @hide
      */
+    @SystemApi
     public static final String HDMI_CONTROL_SERVICE = "hdmi_control";
 
     /**
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index fad3851..cd0de12 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -2731,6 +2731,7 @@
      * returned in {@link #getClipData()}.
      *
      * @see DocumentsContract
+     * @see #ACTION_OPEN_DOCUMENT_TREE
      * @see #ACTION_CREATE_DOCUMENT
      * @see #FLAG_GRANT_PERSISTABLE_URI_PERMISSION
      */
@@ -2765,28 +2766,30 @@
      *
      * @see DocumentsContract
      * @see #ACTION_OPEN_DOCUMENT
+     * @see #ACTION_OPEN_DOCUMENT_TREE
      * @see #FLAG_GRANT_PERSISTABLE_URI_PERMISSION
      */
     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
     public static final String ACTION_CREATE_DOCUMENT = "android.intent.action.CREATE_DOCUMENT";
 
     /**
-     * Activity Action: Allow the user to pick a directory. When invoked, the
-     * system will display the various {@link DocumentsProvider} instances
-     * installed on the device, letting the user navigate through them. Apps can
-     * fully manage documents within the returned directory.
+     * Activity Action: Allow the user to pick a directory subtree. When
+     * invoked, the system will display the various {@link DocumentsProvider}
+     * instances installed on the device, letting the user navigate through
+     * them. Apps can fully manage documents within the returned directory.
      * <p>
      * To gain access to descendant (child, grandchild, etc) documents, use
-     * {@link DocumentsContract#buildDocumentViaUri(Uri, String)} and
-     * {@link DocumentsContract#buildChildDocumentsViaUri(Uri, String)} using
-     * the returned directory URI.
+     * {@link DocumentsContract#buildDocumentUriUsingTree(Uri, String)} and
+     * {@link DocumentsContract#buildChildDocumentsUriUsingTree(Uri, String)}
+     * with the returned URI.
      * <p>
-     * Output: The URI representing the selected directory.
+     * Output: The URI representing the selected directory tree.
      *
      * @see DocumentsContract
      */
     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
-    public static final String ACTION_PICK_DIRECTORY = "android.intent.action.PICK_DIRECTORY";
+    public static final String
+            ACTION_OPEN_DOCUMENT_TREE = "android.intent.action.OPEN_DOCUMENT_TREE";
 
     // ---------------------------------------------------------------------
     // ---------------------------------------------------------------------
@@ -3365,8 +3368,8 @@
      *
      * @see #ACTION_GET_CONTENT
      * @see #ACTION_OPEN_DOCUMENT
+     * @see #ACTION_OPEN_DOCUMENT_TREE
      * @see #ACTION_CREATE_DOCUMENT
-     * @see #ACTION_PICK_DIRECTORY
      */
     public static final String EXTRA_LOCAL_ONLY =
             "android.intent.extra.LOCAL_ONLY";
diff --git a/core/java/android/content/pm/ContainerEncryptionParams.java b/core/java/android/content/pm/ContainerEncryptionParams.java
index dd1332b..ab3aa27 100644
--- a/core/java/android/content/pm/ContainerEncryptionParams.java
+++ b/core/java/android/content/pm/ContainerEncryptionParams.java
@@ -16,7 +16,7 @@
 
 package android.content.pm;
 
-import android.annotation.PrivateApi;
+import android.annotation.SystemApi;
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.text.TextUtils;
@@ -35,7 +35,7 @@
  * @deprecated encrypted containers are legacy.
  * @hide
  */
-@PrivateApi
+@SystemApi
 @Deprecated
 public class ContainerEncryptionParams implements Parcelable {
     protected static final String TAG = "ContainerEncryptionParams";
diff --git a/core/java/android/content/pm/ManifestDigest.java b/core/java/android/content/pm/ManifestDigest.java
index 943534f..1fbef7a 100644
--- a/core/java/android/content/pm/ManifestDigest.java
+++ b/core/java/android/content/pm/ManifestDigest.java
@@ -16,7 +16,7 @@
 
 package android.content.pm;
 
-import android.annotation.PrivateApi;
+import android.annotation.SystemApi;
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.util.Slog;
@@ -37,7 +37,7 @@
  *
  * @hide
  */
-@PrivateApi
+@SystemApi
 public class ManifestDigest implements Parcelable {
     private static final String TAG = "ManifestDigest";
 
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index aadb10e..0ba7180 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -17,7 +17,7 @@
 package android.content.pm;
 
 import android.annotation.IntDef;
-import android.annotation.PrivateApi;
+import android.annotation.SystemApi;
 import android.annotation.SdkConstant;
 import android.annotation.SdkConstant.SdkConstantType;
 import android.app.PackageInstallObserver;
@@ -370,7 +370,7 @@
      * {@link #installPackage(android.net.Uri, IPackageInstallObserver, int)} on success.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_SUCCEEDED = 1;
 
     /**
@@ -379,7 +379,7 @@
      * already installed.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_ALREADY_EXISTS = -1;
 
     /**
@@ -388,7 +388,7 @@
      * file is invalid.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_INVALID_APK = -2;
 
     /**
@@ -397,7 +397,7 @@
      * is invalid.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_INVALID_URI = -3;
 
     /**
@@ -406,7 +406,7 @@
      * service found that the device didn't have enough storage space to install the app.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_INSUFFICIENT_STORAGE = -4;
 
     /**
@@ -415,7 +415,7 @@
      * package is already installed with the same name.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_DUPLICATE_PACKAGE = -5;
 
     /**
@@ -424,7 +424,7 @@
      * the requested shared user does not exist.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_NO_SHARED_USER = -6;
 
     /**
@@ -434,7 +434,7 @@
      * than the new package (and the old package's data was not removed).
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_UPDATE_INCOMPATIBLE = -7;
 
     /**
@@ -444,7 +444,7 @@
      * device and does not have matching signature.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_SHARED_USER_INCOMPATIBLE = -8;
 
     /**
@@ -453,7 +453,7 @@
      * the new package uses a shared library that is not available.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_MISSING_SHARED_LIBRARY = -9;
 
     /**
@@ -462,7 +462,7 @@
      * the new package uses a shared library that is not available.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_REPLACE_COULDNT_DELETE = -10;
 
     /**
@@ -472,7 +472,7 @@
      * either because there was not enough storage or the validation failed.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_DEXOPT = -11;
 
     /**
@@ -482,7 +482,7 @@
      * that required by the package.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_OLDER_SDK = -12;
 
     /**
@@ -492,7 +492,7 @@
      * same authority as a provider already installed in the system.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_CONFLICTING_PROVIDER = -13;
 
     /**
@@ -502,7 +502,7 @@
      * that required by the package.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_NEWER_SDK = -14;
 
     /**
@@ -513,7 +513,7 @@
      * flag.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_TEST_ONLY = -15;
 
     /**
@@ -523,7 +523,7 @@
      * compatible with the the device's CPU_ABI.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_CPU_ABI_INCOMPATIBLE = -16;
 
     /**
@@ -532,7 +532,7 @@
      * the new package uses a feature that is not available.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_MISSING_FEATURE = -17;
 
     // ------ Errors related to sdcard
@@ -542,7 +542,7 @@
      * a secure container mount point couldn't be accessed on external media.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_CONTAINER_ERROR = -18;
 
     /**
@@ -552,7 +552,7 @@
      * location.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_INVALID_INSTALL_LOCATION = -19;
 
     /**
@@ -562,7 +562,7 @@
      * location because the media is not available.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_MEDIA_UNAVAILABLE = -20;
 
     /**
@@ -571,7 +571,7 @@
      * the new package couldn't be installed because the verification timed out.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_VERIFICATION_TIMEOUT = -21;
 
     /**
@@ -580,7 +580,7 @@
      * the new package couldn't be installed because the verification did not succeed.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_VERIFICATION_FAILURE = -22;
 
     /**
@@ -589,7 +589,7 @@
      * the package changed from what the calling program expected.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_PACKAGE_CHANGED = -23;
 
     /**
@@ -615,7 +615,7 @@
      * '.apk' extension.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_PARSE_FAILED_NOT_APK = -100;
 
     /**
@@ -624,7 +624,7 @@
      * if the parser was unable to retrieve the AndroidManifest.xml file.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_PARSE_FAILED_BAD_MANIFEST = -101;
 
     /**
@@ -633,7 +633,7 @@
      * if the parser encountered an unexpected exception.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION = -102;
 
     /**
@@ -642,7 +642,7 @@
      * if the parser did not find any certificates in the .apk.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_PARSE_FAILED_NO_CERTIFICATES = -103;
 
     /**
@@ -651,7 +651,7 @@
      * if the parser found inconsistent certificates on the files in the .apk.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES = -104;
 
     /**
@@ -661,7 +661,7 @@
      * files in the .apk.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING = -105;
 
     /**
@@ -670,7 +670,7 @@
      * if the parser encountered a bad or missing package name in the manifest.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME = -106;
 
     /**
@@ -679,7 +679,7 @@
      * if the parser encountered a bad shared user id name in the manifest.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID = -107;
 
     /**
@@ -688,7 +688,7 @@
      * if the parser encountered some structural problem in the manifest.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_PARSE_FAILED_MANIFEST_MALFORMED = -108;
 
     /**
@@ -698,7 +698,7 @@
      * in the manifest.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_PARSE_FAILED_MANIFEST_EMPTY = -109;
 
     /**
@@ -707,7 +707,7 @@
      * if the system failed to install the package because of system issues.
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public static final int INSTALL_FAILED_INTERNAL_ERROR = -110;
 
     /**
@@ -2907,7 +2907,7 @@
      * instead.  This method will continue to be supported but the older observer interface
      * will not get additional failure details.
      */
-    // @PrivateApi
+    // @SystemApi
     public abstract void installPackage(
             Uri packageURI, IPackageInstallObserver observer, int flags,
             String installerPackageName);
@@ -2942,7 +2942,7 @@
      * continue to be supported but the older observer interface will not get additional failure
      * details.
      */
-    // @PrivateApi
+    // @SystemApi
     public abstract void installPackageWithVerification(Uri packageURI,
             IPackageInstallObserver observer, int flags, String installerPackageName,
             Uri verificationURI, ManifestDigest manifestDigest,
@@ -3071,7 +3071,7 @@
      * on the system for other users, also install it for the calling user.
      * @hide
      */
-    // @PrivateApi
+    // @SystemApi
     public abstract int installExistingPackage(String packageName)
             throws NameNotFoundException;
 
@@ -3161,7 +3161,7 @@
      *
      * @hide
      */
-    // @PrivateApi
+    // @SystemApi
     public abstract void deletePackage(
             String packageName, IPackageDeleteObserver observer, int flags);
 
@@ -3230,7 +3230,7 @@
      *
      * @hide
      */
-    // @PrivateApi
+    // @SystemApi
     public abstract void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer);
 
     /**
diff --git a/core/java/android/hardware/hdmi/HdmiCec.java b/core/java/android/hardware/hdmi/HdmiCec.java
index 723eda1..8ad9463 100644
--- a/core/java/android/hardware/hdmi/HdmiCec.java
+++ b/core/java/android/hardware/hdmi/HdmiCec.java
@@ -16,9 +16,14 @@
 
 package android.hardware.hdmi;
 
+import android.annotation.SystemApi;
+
 /**
  * Defines constants and utility methods related to HDMI-CEC protocol.
+ *
+ * @hide
  */
+@SystemApi
 public final class HdmiCec {
 
     /** TV device type. */
diff --git a/core/java/android/hardware/hdmi/HdmiCecDeviceInfo.java b/core/java/android/hardware/hdmi/HdmiCecDeviceInfo.java
index 9698445..fbfcca0 100644
--- a/core/java/android/hardware/hdmi/HdmiCecDeviceInfo.java
+++ b/core/java/android/hardware/hdmi/HdmiCecDeviceInfo.java
@@ -16,6 +16,7 @@
 
 package android.hardware.hdmi;
 
+import android.annotation.SystemApi;
 import android.os.Parcel;
 import android.os.Parcelable;
 
@@ -23,7 +24,10 @@
  * A class to encapsulate device information for HDMI-CEC. This container
  * include basic information such as logical address, physical address and
  * device type, and additional information like vendor id and osd name.
+ *
+ * @hide
  */
+@SystemApi
 public final class HdmiCecDeviceInfo implements Parcelable {
     // Logical address, phsical address, device type, vendor id and display name
     // are immutable value.
diff --git a/core/java/android/hardware/hdmi/HdmiCecMessage.java b/core/java/android/hardware/hdmi/HdmiCecMessage.java
index 62fa279..ac16ad8 100644
--- a/core/java/android/hardware/hdmi/HdmiCecMessage.java
+++ b/core/java/android/hardware/hdmi/HdmiCecMessage.java
@@ -16,6 +16,7 @@
 
 package android.hardware.hdmi;
 
+import android.annotation.SystemApi;
 import android.os.Parcel;
 import android.os.Parcelable;
 
@@ -27,7 +28,10 @@
  * A class to encapsulate HDMI-CEC message used for the devices connected via
  * HDMI cable to communicate with one another. A message is defined by its
  * source and destination address, command (or opcode), and optional parameters.
+ *
+ * @hide
  */
+@SystemApi
 public final class HdmiCecMessage implements Parcelable {
 
     public static final byte[] EMPTY_PARAM = EmptyArray.BYTE;
diff --git a/core/java/android/hardware/hdmi/HdmiControlManager.java b/core/java/android/hardware/hdmi/HdmiControlManager.java
index 5b6e862..f15fa00 100644
--- a/core/java/android/hardware/hdmi/HdmiControlManager.java
+++ b/core/java/android/hardware/hdmi/HdmiControlManager.java
@@ -17,6 +17,7 @@
 package android.hardware.hdmi;
 
 import android.annotation.Nullable;
+import android.annotation.SystemApi;
 import android.os.RemoteException;
 
 /**
@@ -28,7 +29,10 @@
  * {@link HdmiTvClient} object if the system is configured to host one. Android system
  * can host more than one logical CEC devices. If multiple types are configured they
  * all work as if they were independent logical devices running in the system.
+ *
+ * @hide
  */
+@SystemApi
 public final class HdmiControlManager {
     @Nullable private final IHdmiControlService mService;
 
diff --git a/core/java/android/hardware/hdmi/HdmiHotplugEvent.java b/core/java/android/hardware/hdmi/HdmiHotplugEvent.java
index 1462f83..7be4bc5 100644
--- a/core/java/android/hardware/hdmi/HdmiHotplugEvent.java
+++ b/core/java/android/hardware/hdmi/HdmiHotplugEvent.java
@@ -16,12 +16,16 @@
 
 package android.hardware.hdmi;
 
+import android.annotation.SystemApi;
 import android.os.Parcel;
 import android.os.Parcelable;
 
 /**
  * A class that describes the HDMI port hotplug event.
+ *
+ * @hide
  */
+@SystemApi
 public final class HdmiHotplugEvent implements Parcelable {
 
     private final int mPort;
diff --git a/core/java/android/hardware/hdmi/HdmiPlaybackClient.java b/core/java/android/hardware/hdmi/HdmiPlaybackClient.java
index f0bd237..2e49a38 100644
--- a/core/java/android/hardware/hdmi/HdmiPlaybackClient.java
+++ b/core/java/android/hardware/hdmi/HdmiPlaybackClient.java
@@ -16,6 +16,7 @@
 
 package android.hardware.hdmi;
 
+import android.annotation.SystemApi;
 import android.os.RemoteException;
 
 import android.util.Log;
@@ -25,7 +26,10 @@
  * in the Android system which acts as a playback device such as set-top box.
  * It provides with methods that control, get information from TV/Display device
  * connected through HDMI bus.
+ *
+ * @hide
  */
+@SystemApi
 public final class HdmiPlaybackClient {
     private static final String TAG = "HdmiPlaybackClient";
 
diff --git a/core/java/android/hardware/hdmi/HdmiTvClient.java b/core/java/android/hardware/hdmi/HdmiTvClient.java
index 73c72472..6dc4a4f 100644
--- a/core/java/android/hardware/hdmi/HdmiTvClient.java
+++ b/core/java/android/hardware/hdmi/HdmiTvClient.java
@@ -15,11 +15,16 @@
  */
 package android.hardware.hdmi;
 
+import android.annotation.SystemApi;
+
 /**
  * HdmiTvClient represents HDMI-CEC logical device of type TV in the Android system
  * which acts as TV/Display. It provides with methods that manage, interact with other
  * devices on the CEC bus.
+ *
+ * @hide
  */
+@SystemApi
 public final class HdmiTvClient {
     private static final String TAG = "HdmiTvClient";
 
diff --git a/core/java/android/provider/DocumentsContract.java b/core/java/android/provider/DocumentsContract.java
index 6b8e2de..327fe4a 100644
--- a/core/java/android/provider/DocumentsContract.java
+++ b/core/java/android/provider/DocumentsContract.java
@@ -60,7 +60,8 @@
  * <p>
  * All client apps must hold a valid URI permission grant to access documents,
  * typically issued when a user makes a selection through
- * {@link Intent#ACTION_OPEN_DOCUMENT} or {@link Intent#ACTION_CREATE_DOCUMENT}.
+ * {@link Intent#ACTION_OPEN_DOCUMENT}, {@link Intent#ACTION_CREATE_DOCUMENT},
+ * or {@link Intent#ACTION_OPEN_DOCUMENT_TREE}.
  *
  * @see DocumentsProvider
  */
@@ -73,8 +74,8 @@
     // content://com.example/root/sdcard/search/?query=pony
     // content://com.example/document/12/
     // content://com.example/document/12/children/
-    // content://com.example/via/12/document/24/
-    // content://com.example/via/12/document/24/children/
+    // content://com.example/tree/12/document/24/
+    // content://com.example/tree/12/document/24/children/
 
     private DocumentsContract() {
     }
@@ -441,12 +442,13 @@
         public static final int FLAG_SUPPORTS_SEARCH = 1 << 3;
 
         /**
-         * Flag indicating that this root supports directory selection.
+         * Flag indicating that this root supports testing parent child
+         * relationships.
          *
          * @see #COLUMN_FLAGS
          * @see DocumentsProvider#isChildDocument(String, String)
          */
-        public static final int FLAG_SUPPORTS_DIR_SELECTION = 1 << 4;
+        public static final int FLAG_SUPPORTS_IS_CHILD = 1 << 4;
 
         /**
          * Flag indicating that this root is currently empty. This may be used
@@ -518,7 +520,7 @@
     private static final String PATH_DOCUMENT = "document";
     private static final String PATH_CHILDREN = "children";
     private static final String PATH_SEARCH = "search";
-    private static final String PATH_VIA = "via";
+    private static final String PATH_TREE = "tree";
 
     private static final String PARAM_QUERY = "query";
     private static final String PARAM_MANAGE = "manage";
@@ -564,17 +566,17 @@
      * Build URI representing access to descendant documents of the given
      * {@link Document#COLUMN_DOCUMENT_ID}.
      *
-     * @see #getViaDocumentId(Uri)
+     * @see #getTreeDocumentId(Uri)
      */
-    public static Uri buildViaUri(String authority, String documentId) {
+    public static Uri buildTreeDocumentUri(String authority, String documentId) {
         return new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT).authority(authority)
-                .appendPath(PATH_VIA).appendPath(documentId).build();
+                .appendPath(PATH_TREE).appendPath(documentId).build();
     }
 
     /**
-     * Build URI representing the given {@link Document#COLUMN_DOCUMENT_ID} in a
-     * document provider. When queried, a provider will return a single row with
-     * columns defined by {@link Document}.
+     * Build URI representing the target {@link Document#COLUMN_DOCUMENT_ID} in
+     * a document provider. When queried, a provider will return a single row
+     * with columns defined by {@link Document}.
      *
      * @see DocumentsProvider#queryDocument(String, String[])
      * @see #getDocumentId(Uri)
@@ -585,42 +587,46 @@
     }
 
     /**
-     * Build URI representing the given {@link Document#COLUMN_DOCUMENT_ID} in a
-     * document provider. Instead of directly accessing the target document,
-     * gain access via another document. The target document must be a
-     * descendant (child, grandchild, etc) of the via document.
+     * Build URI representing the target {@link Document#COLUMN_DOCUMENT_ID} in
+     * a document provider. When queried, a provider will return a single row
+     * with columns defined by {@link Document}.
+     * <p>
+     * However, instead of directly accessing the target document, the returned
+     * URI will leverage access granted through a subtree URI, typically
+     * returned by {@link Intent#ACTION_OPEN_DOCUMENT_TREE}. The target document
+     * must be a descendant (child, grandchild, etc) of the subtree.
      * <p>
      * This is typically used to access documents under a user-selected
-     * directory, since it doesn't require the user to separately confirm each
-     * new document access.
+     * directory tree, since it doesn't require the user to separately confirm
+     * each new document access.
      *
-     * @param viaUri a related document (directory) that the caller is
-     *            leveraging to gain access to the target document. The target
-     *            document must be a descendant of this directory.
+     * @param treeUri the subtree to leverage to gain access to the target
+     *            document. The target directory must be a descendant of this
+     *            subtree.
      * @param documentId the target document, which the caller may not have
      *            direct access to.
-     * @see Intent#ACTION_PICK_DIRECTORY
+     * @see Intent#ACTION_OPEN_DOCUMENT_TREE
      * @see DocumentsProvider#isChildDocument(String, String)
      * @see #buildDocumentUri(String, String)
      */
-    public static Uri buildDocumentViaUri(Uri viaUri, String documentId) {
+    public static Uri buildDocumentUriUsingTree(Uri treeUri, String documentId) {
         return new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT)
-                .authority(viaUri.getAuthority()).appendPath(PATH_VIA)
-                .appendPath(getViaDocumentId(viaUri)).appendPath(PATH_DOCUMENT)
+                .authority(treeUri.getAuthority()).appendPath(PATH_TREE)
+                .appendPath(getTreeDocumentId(treeUri)).appendPath(PATH_DOCUMENT)
                 .appendPath(documentId).build();
     }
 
     /** {@hide} */
-    public static Uri buildDocumentMaybeViaUri(Uri baseUri, String documentId) {
-        if (isViaUri(baseUri)) {
-            return buildDocumentViaUri(baseUri, documentId);
+    public static Uri buildDocumentUriMaybeUsingTree(Uri baseUri, String documentId) {
+        if (isTreeUri(baseUri)) {
+            return buildDocumentUriUsingTree(baseUri, documentId);
         } else {
             return buildDocumentUri(baseUri.getAuthority(), documentId);
         }
     }
 
     /**
-     * Build URI representing the children of the given directory in a document
+     * Build URI representing the children of the target directory in a document
      * provider. When queried, a provider will return zero or more rows with
      * columns defined by {@link Document}.
      *
@@ -637,28 +643,33 @@
     }
 
     /**
-     * Build URI representing the children of the given directory in a document
-     * provider. Instead of directly accessing the target document, gain access
-     * via another document. The target document must be a descendant (child,
-     * grandchild, etc) of the via document.
+     * Build URI representing the children of the target directory in a document
+     * provider. When queried, a provider will return zero or more rows with
+     * columns defined by {@link Document}.
+     * <p>
+     * However, instead of directly accessing the target directory, the returned
+     * URI will leverage access granted through a subtree URI, typically
+     * returned by {@link Intent#ACTION_OPEN_DOCUMENT_TREE}. The target
+     * directory must be a descendant (child, grandchild, etc) of the subtree.
      * <p>
      * This is typically used to access documents under a user-selected
-     * directory, since it doesn't require the user to separately confirm each
-     * new document access.
+     * directory tree, since it doesn't require the user to separately confirm
+     * each new document access.
      *
-     * @param viaUri a related document (directory) that the caller is
-     *            leveraging to gain access to the target document. The target
-     *            document must be a descendant of this directory.
-     * @param parentDocumentId the target document, which the caller may not
-     *            have direct access to.
-     * @see Intent#ACTION_PICK_DIRECTORY
+     * @param treeUri the subtree to leverage to gain access to the target
+     *            document. The target directory must be a descendant of this
+     *            subtree.
+     * @param parentDocumentId the document to return children for, which the
+     *            caller may not have direct access to, and which must be a
+     *            directory with MIME type of {@link Document#MIME_TYPE_DIR}.
+     * @see Intent#ACTION_OPEN_DOCUMENT_TREE
      * @see DocumentsProvider#isChildDocument(String, String)
      * @see #buildChildDocumentsUri(String, String)
      */
-    public static Uri buildChildDocumentsViaUri(Uri viaUri, String parentDocumentId) {
+    public static Uri buildChildDocumentsUriUsingTree(Uri treeUri, String parentDocumentId) {
         return new Uri.Builder().scheme(ContentResolver.SCHEME_CONTENT)
-                .authority(viaUri.getAuthority()).appendPath(PATH_VIA)
-                .appendPath(getViaDocumentId(viaUri)).appendPath(PATH_DOCUMENT)
+                .authority(treeUri.getAuthority()).appendPath(PATH_TREE)
+                .appendPath(getTreeDocumentId(treeUri)).appendPath(PATH_DOCUMENT)
                 .appendPath(parentDocumentId).appendPath(PATH_CHILDREN).build();
     }
 
@@ -683,21 +694,24 @@
      * {@link DocumentsProvider}.
      *
      * @see #buildDocumentUri(String, String)
-     * @see #buildDocumentViaUri(Uri, String)
+     * @see #buildDocumentUriUsingTree(Uri, String)
      */
     public static boolean isDocumentUri(Context context, Uri uri) {
         final List<String> paths = uri.getPathSegments();
-        if (paths.size() >= 2
-                && (PATH_DOCUMENT.equals(paths.get(0)) || PATH_VIA.equals(paths.get(0)))) {
+        if (paths.size() == 2 && PATH_DOCUMENT.equals(paths.get(0))) {
+            return isDocumentsProvider(context, uri.getAuthority());
+        }
+        if (paths.size() == 4 && PATH_TREE.equals(paths.get(0))
+                && PATH_DOCUMENT.equals(paths.get(2))) {
             return isDocumentsProvider(context, uri.getAuthority());
         }
         return false;
     }
 
     /** {@hide} */
-    public static boolean isViaUri(Uri uri) {
+    public static boolean isTreeUri(Uri uri) {
         final List<String> paths = uri.getPathSegments();
-        return (paths.size() >= 2 && PATH_VIA.equals(paths.get(0)));
+        return (paths.size() >= 2 && PATH_TREE.equals(paths.get(0)));
     }
 
     private static boolean isDocumentsProvider(Context context, String authority) {
@@ -733,7 +747,7 @@
         if (paths.size() >= 2 && PATH_DOCUMENT.equals(paths.get(0))) {
             return paths.get(1);
         }
-        if (paths.size() >= 4 && PATH_VIA.equals(paths.get(0))
+        if (paths.size() >= 4 && PATH_TREE.equals(paths.get(0))
                 && PATH_DOCUMENT.equals(paths.get(2))) {
             return paths.get(3);
         }
@@ -742,12 +756,10 @@
 
     /**
      * Extract the via {@link Document#COLUMN_DOCUMENT_ID} from the given URI.
-     *
-     * @see #isViaUri(Uri)
      */
-    public static String getViaDocumentId(Uri documentUri) {
+    public static String getTreeDocumentId(Uri documentUri) {
         final List<String> paths = documentUri.getPathSegments();
-        if (paths.size() >= 2 && PATH_VIA.equals(paths.get(0))) {
+        if (paths.size() >= 2 && PATH_TREE.equals(paths.get(0))) {
             return paths.get(1);
         }
         throw new IllegalArgumentException("Invalid URI: " + documentUri);
diff --git a/core/java/android/provider/DocumentsProvider.java b/core/java/android/provider/DocumentsProvider.java
index 066b4aa..021fff4 100644
--- a/core/java/android/provider/DocumentsProvider.java
+++ b/core/java/android/provider/DocumentsProvider.java
@@ -20,10 +20,14 @@
 import static android.provider.DocumentsContract.METHOD_CREATE_DOCUMENT;
 import static android.provider.DocumentsContract.METHOD_DELETE_DOCUMENT;
 import static android.provider.DocumentsContract.METHOD_RENAME_DOCUMENT;
+import static android.provider.DocumentsContract.buildDocumentUri;
+import static android.provider.DocumentsContract.buildDocumentUriMaybeUsingTree;
+import static android.provider.DocumentsContract.buildTreeDocumentUri;
 import static android.provider.DocumentsContract.getDocumentId;
 import static android.provider.DocumentsContract.getRootId;
 import static android.provider.DocumentsContract.getSearchDocumentsQuery;
-import static android.provider.DocumentsContract.isViaUri;
+import static android.provider.DocumentsContract.getTreeDocumentId;
+import static android.provider.DocumentsContract.isTreeUri;
 
 import android.content.ContentProvider;
 import android.content.ContentResolver;
@@ -117,6 +121,7 @@
  * </p>
  *
  * @see Intent#ACTION_OPEN_DOCUMENT
+ * @see Intent#ACTION_OPEN_DOCUMENT_TREE
  * @see Intent#ACTION_CREATE_DOCUMENT
  */
 public abstract class DocumentsProvider extends ContentProvider {
@@ -128,8 +133,8 @@
     private static final int MATCH_SEARCH = 4;
     private static final int MATCH_DOCUMENT = 5;
     private static final int MATCH_CHILDREN = 6;
-    private static final int MATCH_DOCUMENT_VIA = 7;
-    private static final int MATCH_CHILDREN_VIA = 8;
+    private static final int MATCH_DOCUMENT_TREE = 7;
+    private static final int MATCH_CHILDREN_TREE = 8;
 
     private String mAuthority;
 
@@ -149,8 +154,8 @@
         mMatcher.addURI(mAuthority, "root/*/search", MATCH_SEARCH);
         mMatcher.addURI(mAuthority, "document/*", MATCH_DOCUMENT);
         mMatcher.addURI(mAuthority, "document/*/children", MATCH_CHILDREN);
-        mMatcher.addURI(mAuthority, "via/*/document/*", MATCH_DOCUMENT_VIA);
-        mMatcher.addURI(mAuthority, "via/*/document/*/children", MATCH_CHILDREN_VIA);
+        mMatcher.addURI(mAuthority, "tree/*/document/*", MATCH_DOCUMENT_TREE);
+        mMatcher.addURI(mAuthority, "tree/*/document/*/children", MATCH_CHILDREN_TREE);
 
         // Sanity check our setup
         if (!info.exported) {
@@ -169,23 +174,24 @@
 
     /**
      * Test if a document is descendant (child, grandchild, etc) from the given
-     * parent. Providers must override this to support directory selection. You
-     * should avoid making network requests to keep this request fast.
+     * parent. For example, providers must implement this to support
+     * {@link Intent#ACTION_OPEN_DOCUMENT_TREE}. You should avoid making network
+     * requests to keep this request fast.
      *
      * @param parentDocumentId parent to verify against.
      * @param documentId child to verify.
      * @return if given document is a descendant of the given parent.
-     * @see DocumentsContract.Root#FLAG_SUPPORTS_DIR_SELECTION
+     * @see DocumentsContract.Root#FLAG_SUPPORTS_IS_CHILD
      */
     public boolean isChildDocument(String parentDocumentId, String documentId) {
         return false;
     }
 
     /** {@hide} */
-    private void enforceVia(Uri documentUri) {
-        if (DocumentsContract.isViaUri(documentUri)) {
-            final String parent = DocumentsContract.getViaDocumentId(documentUri);
-            final String child = DocumentsContract.getDocumentId(documentUri);
+    private void enforceTree(Uri documentUri) {
+        if (isTreeUri(documentUri)) {
+            final String parent = getTreeDocumentId(documentUri);
+            final String child = getDocumentId(documentUri);
             if (Objects.equals(parent, child)) {
                 return;
             }
@@ -479,12 +485,12 @@
                     return querySearchDocuments(
                             getRootId(uri), getSearchDocumentsQuery(uri), projection);
                 case MATCH_DOCUMENT:
-                case MATCH_DOCUMENT_VIA:
-                    enforceVia(uri);
+                case MATCH_DOCUMENT_TREE:
+                    enforceTree(uri);
                     return queryDocument(getDocumentId(uri), projection);
                 case MATCH_CHILDREN:
-                case MATCH_CHILDREN_VIA:
-                    enforceVia(uri);
+                case MATCH_CHILDREN_TREE:
+                    enforceTree(uri);
                     if (DocumentsContract.isManageMode(uri)) {
                         return queryChildDocumentsForManage(
                                 getDocumentId(uri), projection, sortOrder);
@@ -512,8 +518,8 @@
                 case MATCH_ROOT:
                     return DocumentsContract.Root.MIME_TYPE_ITEM;
                 case MATCH_DOCUMENT:
-                case MATCH_DOCUMENT_VIA:
-                    enforceVia(uri);
+                case MATCH_DOCUMENT_TREE:
+                    enforceTree(uri);
                     return getDocumentType(getDocumentId(uri));
                 default:
                     return null;
@@ -530,21 +536,20 @@
      * call the superclass. If the superclass returns {@code null}, the subclass
      * may implement custom behavior.
      * <p>
-     * This is typically used to resolve a "via" URI into a concrete document
+     * This is typically used to resolve a subtree URI into a concrete document
      * reference, issuing a narrower single-document URI permission grant along
      * the way.
      *
-     * @see DocumentsContract#buildDocumentViaUri(Uri, String)
+     * @see DocumentsContract#buildDocumentUriUsingTree(Uri, String)
      */
     @Override
     public Uri canonicalize(Uri uri) {
         final Context context = getContext();
         switch (mMatcher.match(uri)) {
-            case MATCH_DOCUMENT_VIA:
-                enforceVia(uri);
+            case MATCH_DOCUMENT_TREE:
+                enforceTree(uri);
 
-                final Uri narrowUri = DocumentsContract.buildDocumentUri(uri.getAuthority(),
-                        DocumentsContract.getDocumentId(uri));
+                final Uri narrowUri = buildDocumentUri(uri.getAuthority(), getDocumentId(uri));
 
                 // Caller may only have prefix grant, so extend them a grant to
                 // the narrow URI.
@@ -628,7 +633,7 @@
             throw new SecurityException(
                     "Requested authority " + authority + " doesn't match provider " + mAuthority);
         }
-        enforceVia(documentUri);
+        enforceTree(documentUri);
 
         final Bundle out = new Bundle();
         try {
@@ -641,8 +646,8 @@
 
                 // No need to issue new grants here, since caller either has
                 // manage permission or a prefix grant. We might generate a
-                // "via" style URI if that's how they called us.
-                final Uri newDocumentUri = DocumentsContract.buildDocumentMaybeViaUri(documentUri,
+                // tree style URI if that's how they called us.
+                final Uri newDocumentUri = buildDocumentUriMaybeUsingTree(documentUri,
                         newDocumentId);
                 out.putParcelable(DocumentsContract.EXTRA_URI, newDocumentUri);
 
@@ -653,12 +658,12 @@
                 final String newDocumentId = renameDocument(documentId, displayName);
 
                 if (newDocumentId != null) {
-                    final Uri newDocumentUri = DocumentsContract.buildDocumentMaybeViaUri(
-                            documentUri, newDocumentId);
+                    final Uri newDocumentUri = buildDocumentUriMaybeUsingTree(documentUri,
+                            newDocumentId);
 
                     // If caller came in with a narrow grant, issue them a
                     // narrow grant for the newly renamed document.
-                    if (!isViaUri(newDocumentUri)) {
+                    if (!isTreeUri(newDocumentUri)) {
                         final int modeFlags = getCallingOrSelfUriPermissionModeFlags(context,
                                 documentUri);
                         context.grantUriPermission(getCallingPackage(), newDocumentUri, modeFlags);
@@ -694,8 +699,8 @@
      */
     public final void revokeDocumentPermission(String documentId) {
         final Context context = getContext();
-        context.revokeUriPermission(DocumentsContract.buildDocumentUri(mAuthority, documentId), ~0);
-        context.revokeUriPermission(DocumentsContract.buildViaUri(mAuthority, documentId), ~0);
+        context.revokeUriPermission(buildDocumentUri(mAuthority, documentId), ~0);
+        context.revokeUriPermission(buildTreeDocumentUri(mAuthority, documentId), ~0);
     }
 
     /**
@@ -705,7 +710,7 @@
      */
     @Override
     public final ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
-        enforceVia(uri);
+        enforceTree(uri);
         return openDocument(getDocumentId(uri), mode, null);
     }
 
@@ -717,7 +722,7 @@
     @Override
     public final ParcelFileDescriptor openFile(Uri uri, String mode, CancellationSignal signal)
             throws FileNotFoundException {
-        enforceVia(uri);
+        enforceTree(uri);
         return openDocument(getDocumentId(uri), mode, signal);
     }
 
@@ -730,7 +735,7 @@
     @SuppressWarnings("resource")
     public final AssetFileDescriptor openAssetFile(Uri uri, String mode)
             throws FileNotFoundException {
-        enforceVia(uri);
+        enforceTree(uri);
         final ParcelFileDescriptor fd = openDocument(getDocumentId(uri), mode, null);
         return fd != null ? new AssetFileDescriptor(fd, 0, -1) : null;
     }
@@ -744,7 +749,7 @@
     @SuppressWarnings("resource")
     public final AssetFileDescriptor openAssetFile(Uri uri, String mode, CancellationSignal signal)
             throws FileNotFoundException {
-        enforceVia(uri);
+        enforceTree(uri);
         final ParcelFileDescriptor fd = openDocument(getDocumentId(uri), mode, signal);
         return fd != null ? new AssetFileDescriptor(fd, 0, -1) : null;
     }
@@ -757,7 +762,7 @@
     @Override
     public final AssetFileDescriptor openTypedAssetFile(Uri uri, String mimeTypeFilter, Bundle opts)
             throws FileNotFoundException {
-        enforceVia(uri);
+        enforceTree(uri);
         if (opts != null && opts.containsKey(EXTRA_THUMBNAIL_SIZE)) {
             final Point sizeHint = opts.getParcelable(EXTRA_THUMBNAIL_SIZE);
             return openDocumentThumbnail(getDocumentId(uri), sizeHint, null);
@@ -775,7 +780,7 @@
     public final AssetFileDescriptor openTypedAssetFile(
             Uri uri, String mimeTypeFilter, Bundle opts, CancellationSignal signal)
             throws FileNotFoundException {
-        enforceVia(uri);
+        enforceTree(uri);
         if (opts != null && opts.containsKey(EXTRA_THUMBNAIL_SIZE)) {
             final Point sizeHint = opts.getParcelable(EXTRA_THUMBNAIL_SIZE);
             return openDocumentThumbnail(getDocumentId(uri), sizeHint, signal);
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java
index 557f5a6..fd475cd 100644
--- a/core/java/android/service/notification/NotificationListenerService.java
+++ b/core/java/android/service/notification/NotificationListenerService.java
@@ -16,7 +16,7 @@
 
 package android.service.notification;
 
-import android.annotation.PrivateApi;
+import android.annotation.SystemApi;
 import android.annotation.SdkConstant;
 import android.app.INotificationManager;
 import android.app.Service;
@@ -279,7 +279,7 @@
      * @param currentUser the user to use as the stream filter
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public void registerAsSystemService(ComponentName componentName, int currentUser)
             throws RemoteException {
         if (mWrapper == null) {
@@ -297,7 +297,7 @@
      * with (@link registerAsService).
      * @hide
      */
-    @PrivateApi
+    @SystemApi
     public void unregisterAsSystemService() throws RemoteException {
         if (mWrapper != null) {
             INotificationManager noMan = getNotificationInterface();
diff --git a/core/java/android/service/trust/TrustAgentService.java b/core/java/android/service/trust/TrustAgentService.java
index b3fb560..ed835e4 100644
--- a/core/java/android/service/trust/TrustAgentService.java
+++ b/core/java/android/service/trust/TrustAgentService.java
@@ -17,7 +17,7 @@
 package android.service.trust;
 
 import android.Manifest;
-import android.annotation.PrivateApi;
+import android.annotation.SystemApi;
 import android.annotation.SdkConstant;
 import android.app.Service;
 import android.content.ComponentName;
@@ -60,7 +60,7 @@
  *
  * @hide
  */
-@PrivateApi
+@SystemApi
 public class TrustAgentService extends Service {
     private final String TAG = TrustAgentService.class.getSimpleName() +
             "[" + getClass().getSimpleName() + "]";
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index f57c3a0..90d49968 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -295,7 +295,7 @@
         android:label="@string/permlab_sendSms"
         android:description="@string/permdesc_sendSms" />
 
-    <!-- Allows an application (Phone) to send a request to other applications
+    <!-- @SystemApi Allows an application (Phone) to send a request to other applications
          to handle the respond-via-message action during incoming calls.
          <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.SEND_RESPOND_VIA_MESSAGE"
@@ -320,7 +320,7 @@
         android:label="@string/permlab_receiveMms"
         android:description="@string/permdesc_receiveMms" />
 
-    <!-- Allows an application to receive emergency cell broadcast messages,
+    <!-- @SystemApi Allows an application to receive emergency cell broadcast messages,
          to record or display them to the user.
          <p>Not for use by third-party applications.
          @hide Pending API council approval -->
@@ -400,10 +400,9 @@
         android:label="@string/permlab_writeContacts"
         android:description="@string/permdesc_writeContacts" />
 
-    <!-- Allows an application to execute contacts directory search.
+    <!-- @SystemApi @hide Allows an application to execute contacts directory search.
          This should only be used by ContactsProvider.
          <p>Not for use by third-party applications. -->
-    <!-- @hide -->
     <permission android:name="android.permission.BIND_DIRECTORY_SEARCH"
         android:permissionGroup="android.permission-group.PERSONAL_INFO"
         android:protectionLevel="signature|system" />
@@ -688,20 +687,20 @@
         android:label="@string/permlab_accessLocationExtraCommands"
         android:description="@string/permdesc_accessLocationExtraCommands" />
 
-    <!-- Allows an application to install a location provider into the Location Manager.
+    <!-- @SystemApi Allows an application to install a location provider into the Location Manager.
     <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.INSTALL_LOCATION_PROVIDER"
         android:protectionLevel="signature|system"
         android:label="@string/permlab_installLocationProvider"
         android:description="@string/permdesc_installLocationProvider" />
 
-    <!-- Allows HDMI-CEC service to access device and configuration files.
-         @hide This should only be used by HDMI-CEC service.
+    <!-- @SystemApi @hide Allows HDMI-CEC service to access device and configuration files.
+         This should only be used by HDMI-CEC service.
     -->
     <permission android:name="android.permission.HDMI_CEC"
         android:protectionLevel="signatureOrSystem" />
 
-    <!-- Allows an application to use location features in hardware,
+    <!-- @SystemApi Allows an application to use location features in hardware,
          such as the geofencing api.
          <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.LOCATION_HARDWARE"
@@ -799,7 +798,7 @@
         android:description="@string/permdesc_bluetoothAdmin"
         android:label="@string/permlab_bluetoothAdmin" />
 
-    <!-- Allows applications to pair bluetooth devices without user interaction.
+    <!-- @SystemApi Allows applications to pair bluetooth devices without user interaction.
          This is not available to third party applications. -->
     <permission android:name="android.permission.BLUETOOTH_PRIVILEGED"
         android:permissionGroup="android.permission-group.BLUETOOTH_NETWORK"
@@ -821,18 +820,18 @@
         android:description="@string/permdesc_nfc"
         android:label="@string/permlab_nfc" />
 
-    <!-- Allows an internal user to use privileged ConnectivityManager APIs.
+    <!-- @SystemApi Allows an internal user to use privileged ConnectivityManager APIs.
         @hide -->
     <permission android:name="android.permission.CONNECTIVITY_INTERNAL"
         android:permissionGroup="android.permission-group.NETWORK"
         android:protectionLevel="signature|system" />
 
-    <!-- @hide -->
+    <!-- @SystemApi @hide -->
     <permission android:name="android.permission.RECEIVE_DATA_ACTIVITY_CHANGE"
         android:permissionGroup="android.permission-group.NETWORK"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows access to the loop radio (Android@Home mesh network) device.
+    <!-- @SystemApi Allows access to the loop radio (Android@Home mesh network) device.
 	@hide -->
     <permission android:name="android.permission.LOOP_RADIO"
 	android:permissionGroup="android.permission-group.NETWORK"
@@ -881,7 +880,7 @@
         android:label="@string/permlab_manageAccounts"
         android:description="@string/permdesc_manageAccounts" />
 
-    <!-- Allows applications to call into AccountAuthenticators.
+    <!-- @SystemApi Allows applications to call into AccountAuthenticators.
     <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.ACCOUNT_MANAGER"
         android:permissionGroup="android.permission-group.ACCOUNTS"
@@ -972,7 +971,7 @@
         android:description="@string/permgroupdesc_hardwareControls"
         android:priority="260"/>
 
-    <!-- Allows an application to manage preferences and permissions for USB devices
+    <!-- @SystemApi Allows an application to manage preferences and permissions for USB devices
          @hide -->
     <permission android:name="android.permission.MANAGE_USB"
         android:permissionGroup="android.permission-group.HARDWARE_CONTROLS"
@@ -980,7 +979,7 @@
         android:label="@string/permlab_manageUsb"
         android:description="@string/permdesc_manageUsb" />
 
-    <!-- Allows an application to access the MTP USB kernel driver.
+    <!-- @SystemApi Allows an application to access the MTP USB kernel driver.
          For use only by the device side MTP implementation.
          @hide -->
     <permission android:name="android.permission.ACCESS_MTP"
@@ -1008,7 +1007,7 @@
         android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
         android:protectionLevel="signature" />
 
-    <!-- Allows TvInputService to access underlying TV input hardware such as
+    <!-- @SystemApi Allows TvInputService to access underlying TV input hardware such as
          built-in tuners and HDMI-in's.
          @hide This should only be used by OEM's TvInputService's.
     -->
@@ -1065,7 +1064,7 @@
         android:label="@string/permlab_camera"
         android:description="@string/permdesc_camera" />
 
-    <!-- Allows disabling the transmit-indicator LED that is normally on when
+    <!-- @SystemApi Allows disabling the transmit-indicator LED that is normally on when
          a camera is in use by an application.
          @hide -->
     <permission android:name="android.permission.CAMERA_DISABLE_TRANSMIT_LED"
@@ -1098,7 +1097,7 @@
         android:label="@string/permlab_processOutgoingCalls"
         android:description="@string/permdesc_processOutgoingCalls" />
 
-    <!-- Allows modification of the telephony state - power on, mmi, etc.
+    <!-- @SystemApi Allows modification of the telephony state - power on, mmi, etc.
          Does not include placing calls.
          <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.MODIFY_PHONE_STATE"
@@ -1130,7 +1129,7 @@
         android:label="@string/permlab_readPrecisePhoneState"
         android:description="@string/permdesc_readPrecisePhoneState" />
 
-    <!-- Allows read access to privileged phone state.
+    <!-- @SystemApi Allows read access to privileged phone state.
          @hide Used internally. -->
     <permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"
         android:permissionGroup="android.permission-group.PHONE_CALLS"
@@ -1153,7 +1152,7 @@
         android:description="@string/permdesc_use_sip"
         android:label="@string/permlab_use_sip" />
 
-    <!-- Allows an application to request CallHandlerService implementations.
+    <!-- @SystemApi Allows an application to request CallHandlerService implementations.
          @hide -->
     <permission android:name="android.permission.BIND_CALL_SERVICE"
         android:permissionGroup="android.permission-group.PHONE_CALLS"
@@ -1219,7 +1218,7 @@
         android:description="@string/permdesc_sdcardWrite"
         android:protectionLevel="dangerous" />
 
-    <!-- Allows an application to write to internal media storage
+    <!-- @SystemApi Allows an application to write to internal media storage
          @hide  -->
     <permission android:name="android.permission.WRITE_MEDIA_STORAGE"
         android:permissionGroup="android.permission-group.STORAGE"
@@ -1269,14 +1268,15 @@
         android:description="@string/permgroupdesc_appInfo"
         android:priority="220" />
 
-    <!-- Allows an application to get information about the currently
+    <!-- @SystemApi Allows an application to get information about the currently
          or recently running tasks. -->
     <permission android:name="android.permission.GET_TASKS"
         android:permissionGroup="android.permission-group.APP_INFO"
         android:protectionLevel="signature|system"
         android:label="@string/permlab_getTasks"
         android:description="@string/permdesc_getTasks" />
-    <!-- @hide Allows an application to call APIs that allow it to do interactions
+
+    <!-- @SystemApi @hide Allows an application to call APIs that allow it to do interactions
          across the users on the device, using singleton services and
          user-targeted broadcasts.  This permission is not available to
          third party applications. -->
@@ -1295,7 +1295,7 @@
         android:label="@string/permlab_interactAcrossUsersFull"
         android:description="@string/permdesc_interactAcrossUsersFull" />
 
-    <!-- @hide Allows an application to call APIs that allow it to query and manage
+    <!-- @SystemApi @hide Allows an application to call APIs that allow it to query and manage
          users on the device. This permission is not available to
          third party applications. -->
     <permission android:name="android.permission.MANAGE_USERS"
@@ -1327,7 +1327,7 @@
         android:label="@string/permlab_removeTasks"
         android:description="@string/permdesc_removeTasks" />
 
-    <!-- @hide Allows an application to create/manage/remove stacks -->
+    <!-- @SystemApi @hide Allows an application to create/manage/remove stacks -->
     <permission android:name="android.permission.MANAGE_ACTIVITY_STACKS"
         android:permissionGroup="android.permission-group.APP_INFO"
         android:protectionLevel="signature|system"
@@ -1421,7 +1421,7 @@
         android:description="@string/permgroupdesc_systemClock"
         android:priority="140" />
 
-    <!-- Allows applications to set the system time.
+    <!-- @SystemApi Allows applications to set the system time.
     <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.SET_TIME"
         android:protectionLevel="signature|system"
@@ -1527,7 +1527,7 @@
         android:description="@string/permgroupdesc_systemTools"
         android:priority="100" />
 
-    <!-- @hide Change the screen compatibility mode of applications -->
+    <!-- @SystemApi @hide Change the screen compatibility mode of applications -->
     <permission android:name="android.permission.SET_SCREEN_COMPATIBILITY"
         android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
         android:protectionLevel="signature"
@@ -1541,7 +1541,7 @@
         android:description="@string/permdesc_sdcardAccessAll"
         android:protectionLevel="signature" />
 
-    <!-- Allows an application to modify the current configuration, such
+    <!-- @SystemApi Allows an application to modify the current configuration, such
          as locale. -->
     <permission android:name="android.permission.CHANGE_CONFIGURATION"
         android:permissionGroup="android.permission-group.DEVELOPMENT_TOOLS"
@@ -1556,14 +1556,14 @@
         android:label="@string/permlab_writeSettings"
         android:description="@string/permdesc_writeSettings" />
 
-    <!-- Allows an application to modify the Google service map.
+    <!-- @SystemApi Allows an application to modify the Google service map.
     <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.WRITE_GSERVICES"
         android:protectionLevel="signature|system"
         android:label="@string/permlab_writeGservices"
         android:description="@string/permdesc_writeGservices" />
 
-    <!-- Allows an application to call
+    <!-- @SystemApi Allows an application to call
         {@link android.app.ActivityManager#forceStopPackage}.
         @hide -->
     <permission android:name="android.permission.FORCE_STOP_PACKAGES"
@@ -1572,7 +1572,7 @@
         android:label="@string/permlab_forceStopPackages"
         android:description="@string/permdesc_forceStopPackages" />
 
-    <!-- @hide Allows an application to retrieve the content of the active window
+    <!-- @SystemApi @hide Allows an application to retrieve the content of the active window
          An active window is the window that has fired an accessibility event. -->
     <permission android:name="android.permission.RETRIEVE_WINDOW_CONTENT"
         android:permissionGroup="android.permission-group.PERSONAL_INFO"
@@ -1580,7 +1580,7 @@
         android:label="@string/permlab_retrieve_window_content"
         android:description="@string/permdesc_retrieve_window_content" />
 
-    <!-- Modify the global animation scaling factor.
+    <!-- @SystemApi Modify the global animation scaling factor.
     <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.SET_ANIMATION_SCALE"
         android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
@@ -1639,7 +1639,7 @@
         android:label="@string/permlab_broadcastSticky"
         android:description="@string/permdesc_broadcastSticky" />
 
-    <!-- Allows mounting and unmounting file systems for removable storage.
+    <!-- @SystemApi Allows mounting and unmounting file systems for removable storage.
     <p>Not for use by third-party applications.-->
     <permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
         android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
@@ -1647,7 +1647,7 @@
         android:label="@string/permlab_mount_unmount_filesystems"
         android:description="@string/permdesc_mount_unmount_filesystems" />
 
-    <!-- Allows formatting file systems for removable storage.
+    <!-- @SystemApi Allows formatting file systems for removable storage.
     <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.MOUNT_FORMAT_FILESYSTEMS"
         android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
@@ -1695,7 +1695,7 @@
         android:label="@string/permlab_asec_rename"
         android:description="@string/permdesc_asec_rename" />
 
-    <!-- Allows applications to write the apn settings.
+    <!-- @SystemApi Allows applications to write the apn settings.
     <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.WRITE_APN_SETTINGS"
                 android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
@@ -1731,14 +1731,14 @@
         android:label="@string/permlab_clearAppCache"
         android:description="@string/permdesc_clearAppCache" />
 
-    <!-- Allows an application to use any media decoder when decoding for playback
+    <!-- @SystemApi Allows an application to use any media decoder when decoding for playback
          @hide -->
     <permission android:name="android.permission.ALLOW_ANY_CODEC_FOR_PLAYBACK"
         android:protectionLevel="signature|system"
         android:label="@string/permlab_anyCodecForPlayback"
         android:description="@string/permdesc_anyCodecForPlayback" />
 
-    <!-- Allows an application to install and/or uninstall CA certificates on
+    <!-- @SystemApi Allows an application to install and/or uninstall CA certificates on
          behalf of the user.
          @hide -->
     <permission android:name="android.permission.MANAGE_CA_CERTIFICATES"
@@ -1746,7 +1746,7 @@
         android:label="@string/permlab_manageCaCertificates"
         android:description="@string/permdesc_manageCaCertificates" />
 
-    <!-- Allows an application to do certain operations needed for
+    <!-- @SystemApi Allows an application to do certain operations needed for
          interacting with the recovery (system update) system. -->
     <permission android:name="android.permission.RECOVERY"
         android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
@@ -1775,7 +1775,7 @@
         android:description="@string/permgroupdesc_developmentTools"
         android:priority="310" />
 
-    <!-- Allows an application to read or write the secure system settings.
+    <!-- @SystemApi Allows an application to read or write the secure system settings.
     <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.WRITE_SECURE_SETTINGS"
         android:permissionGroup="android.permission-group.DEVELOPMENT_TOOLS"
@@ -1783,7 +1783,7 @@
         android:label="@string/permlab_writeSecureSettings"
         android:description="@string/permdesc_writeSecureSettings" />
 
-    <!-- Allows an application to retrieve state dump information from system services.
+    <!-- @SystemApi Allows an application to retrieve state dump information from system services.
     <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.DUMP"
         android:permissionGroup="android.permission-group.DEVELOPMENT_TOOLS"
@@ -1791,7 +1791,7 @@
         android:label="@string/permlab_dump"
         android:description="@string/permdesc_dump" />
 
-    <!-- Allows an application to read the low-level system log files.
+    <!-- @SystemApi Allows an application to read the low-level system log files.
     <p>Not for use by third-party applications, because
     Log entries can contain the user's private information. -->
     <permission android:name="android.permission.READ_LOGS"
@@ -1800,7 +1800,7 @@
         android:label="@string/permlab_readLogs"
         android:description="@string/permdesc_readLogs" />
 
-    <!-- Configure an application for debugging.
+    <!-- @SystemApi Configure an application for debugging.
     <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.SET_DEBUG_APP"
         android:permissionGroup="android.permission-group.DEVELOPMENT_TOOLS"
@@ -1808,7 +1808,7 @@
         android:label="@string/permlab_setDebugApp"
         android:description="@string/permdesc_setDebugApp" />
 
-    <!-- Allows an application to set the maximum number of (not needed)
+    <!-- @SystemApi Allows an application to set the maximum number of (not needed)
          application processes that can be running.
          <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.SET_PROCESS_LIMIT"
@@ -1817,7 +1817,7 @@
         android:label="@string/permlab_setProcessLimit"
         android:description="@string/permdesc_setProcessLimit" />
 
-    <!-- Allows an application to control whether activities are immediately
+    <!-- @SystemApi Allows an application to control whether activities are immediately
          finished when put in the background.
          <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.SET_ALWAYS_FINISH"
@@ -1826,7 +1826,7 @@
         android:label="@string/permlab_setAlwaysFinish"
         android:description="@string/permdesc_setAlwaysFinish" />
 
-    <!-- Allow an application to request that a signal be sent to all persistent processes.
+    <!-- @SystemApi Allow an application to request that a signal be sent to all persistent processes.
     <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.SIGNAL_PERSISTENT_PROCESSES"
         android:permissionGroup="android.permission-group.DEVELOPMENT_TOOLS"
@@ -1839,7 +1839,7 @@
     <!-- ==================================== -->
     <eat-comment />
 
-    <!-- Allows applications to RW to diagnostic resources.
+    <!-- @SystemApi Allows applications to RW to diagnostic resources.
     <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.DIAGNOSTIC"
         android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
@@ -1847,7 +1847,7 @@
         android:description="@string/permdesc_diagnostic"
         android:label="@string/permlab_diagnostic" />
 
-    <!-- Allows an application to open, close, or disable the status bar
+    <!-- @SystemApi Allows an application to open, close, or disable the status bar
          and its icons.
          <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.STATUS_BAR"
@@ -1870,21 +1870,21 @@
         android:description="@string/permdesc_forceBack"
         android:protectionLevel="signature" />
 
-    <!-- Allows an application to update device statistics.
+    <!-- @SystemApi Allows an application to update device statistics.
     <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.UPDATE_DEVICE_STATS"
         android:label="@string/permlab_updateBatteryStats"
         android:description="@string/permdesc_updateBatteryStats"
         android:protectionLevel="signature|system" />
 
-    <!-- @hide Allows an application to collect battery statistics -->
+    <!-- @SystemApi @hide Allows an application to collect battery statistics -->
     <permission android:name="android.permission.GET_APP_OPS_STATS"
         android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
         android:label="@string/permlab_getAppOpsStats"
         android:description="@string/permdesc_getAppOpsStats"
         android:protectionLevel="signature|system|development" />
 
-    <!-- Allows an application to update application operation statistics. Not for
+    <!-- @SystemApi Allows an application to update application operation statistics. Not for
          use by third party apps. @hide -->
     <permission android:name="android.permission.UPDATE_APP_OPS_STATS"
         android:label="@string/permlab_updateAppOpsStats"
@@ -1957,7 +1957,7 @@
         android:description="@string/permdesc_runSetActivityWatcher"
         android:protectionLevel="signature" />
 
-    <!-- Allows an application to call the activity manager shutdown() API
+    <!-- @SystemApi Allows an application to call the activity manager shutdown() API
          to put the higher-level system there into a shutdown state.
          @hide -->
     <permission android:name="android.permission.SHUTDOWN"
@@ -1965,7 +1965,7 @@
         android:description="@string/permdesc_shutdown"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows an application to tell the activity manager to temporarily
+    <!-- @SystemApi Allows an application to tell the activity manager to temporarily
          stop application switches, putting it into a special mode that
          prevents applications from immediately switching away from some
          critical UI such as the home screen.
@@ -2086,7 +2086,7 @@
         android:description="@string/permdesc_bindDeviceAdmin"
         android:protectionLevel="signature" />
 
-    <!-- Required to add or remove another application as a device admin.
+    <!-- @SystemApi Required to add or remove another application as a device admin.
          <p>Not for use by third-party applications.
          @hide -->
     <permission android:name="android.permission.MANAGE_DEVICE_ADMINS"
@@ -2125,7 +2125,7 @@
         android:description="@string/permdesc_setKeyboardLayout"
         android:protectionLevel="signature" />
 
-    <!-- Allows an application to install packages.
+    <!-- @SystemApi Allows an application to install packages.
     <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.INSTALL_PACKAGES"
         android:label="@string/permlab_installPackages"
@@ -2139,28 +2139,28 @@
         android:description="@string/permdesc_clearAppUserData"
         android:protectionLevel="signature" />
 
-    <!-- Allows an application to delete cache files.
+    <!-- @SystemApi Allows an application to delete cache files.
     <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.DELETE_CACHE_FILES"
         android:label="@string/permlab_deleteCacheFiles"
         android:description="@string/permdesc_deleteCacheFiles"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows an application to delete packages.
+    <!-- @SystemApi Allows an application to delete packages.
     <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.DELETE_PACKAGES"
         android:label="@string/permlab_deletePackages"
         android:description="@string/permdesc_deletePackages"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows an application to move location of installed package.
+    <!-- @SystemApi Allows an application to move location of installed package.
          @hide -->
     <permission android:name="android.permission.MOVE_PACKAGE"
         android:label="@string/permlab_movePackage"
         android:description="@string/permdesc_movePackage"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows an application to change whether an application component (other than its own) is
+    <!-- @SystemApi Allows an application to change whether an application component (other than its own) is
          enabled or not.
          <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"
@@ -2181,7 +2181,7 @@
         android:description="@string/permdesc_accessSurfaceFlinger"
         android:protectionLevel="signature" />
 
-    <!-- Allows an application to take screen shots and more generally
+    <!-- @SystemApi Allows an application to take screen shots and more generally
          get access to the frame buffer data.
          <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.READ_FRAME_BUFFER"
@@ -2212,14 +2212,14 @@
         android:description="@string/permdesc_controlWifiDisplay"
         android:protectionLevel="signature" />
 
-    <!-- Allows an application to capture audio output.
+    <!-- @SystemApi Allows an application to capture audio output.
          <p>Not for use by third-party applications.</p> -->
     <permission android:name="android.permission.CAPTURE_AUDIO_OUTPUT"
         android:label="@string/permlab_captureAudioOutput"
         android:description="@string/permdesc_captureAudioOutput"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows an application to capture audio for hotword detection.
+    <!-- @SystemApi Allows an application to capture audio for hotword detection.
          <p>Not for use by third-party applications.</p>
          @hide -->
     <permission android:name="android.permission.CAPTURE_AUDIO_HOTWORD"
@@ -2227,7 +2227,7 @@
         android:description="@string/permdesc_captureAudioHotword"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows an application to modify audio routing and override policy decisions.
+    <!-- @SystemApi Allows an application to modify audio routing and override policy decisions.
          <p>Not for use by third-party applications.</p>
          @hide -->
     <permission android:name="android.permission.MODIFY_AUDIO_ROUTING"
@@ -2235,21 +2235,21 @@
         android:description="@string/permdesc_modifyAudioRouting"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows an application to capture video output.
+    <!-- @SystemApi Allows an application to capture video output.
          <p>Not for use by third-party applications.</p> -->
     <permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT"
         android:label="@string/permlab_captureVideoOutput"
         android:description="@string/permdesc_captureVideoOutput"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows an application to capture secure video output.
+    <!-- @SystemApi Allows an application to capture secure video output.
          <p>Not for use by third-party applications.</p> -->
     <permission android:name="android.permission.CAPTURE_SECURE_VIDEO_OUTPUT"
         android:label="@string/permlab_captureSecureVideoOutput"
         android:description="@string/permdesc_captureSecureVideoOutput"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows an application to know what content is playing and control its playback.
+    <!-- @SystemApi Allows an application to know what content is playing and control its playback.
          <p>Not for use by third-party applications due to privacy of media consumption</p>  -->
     <permission android:name="android.permission.MEDIA_CONTENT_CONTROL"
         android:label="@string/permlab_mediaContentControl"
@@ -2263,7 +2263,7 @@
         android:description="@string/permdesc_brick"
         android:protectionLevel="signature" />
 
-    <!-- Required to be able to reboot the device.
+    <!-- @SystemApi Required to be able to reboot the device.
     <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.REBOOT"
         android:label="@string/permlab_reboot"
@@ -2315,20 +2315,20 @@
         android:description="@string/permdesc_broadcastWapPush"
         android:protectionLevel="signature" />
 
-    <!-- Allows an application to broadcast a SCORE_NETWORKS request.
+    <!-- @SystemApi Allows an application to broadcast a SCORE_NETWORKS request.
          <p>Not for use by third-party applications. @hide -->
     <permission android:name="android.permission.BROADCAST_SCORE_NETWORKS"
         android:label="@string/permlab_broadcastScoreNetworks"
         android:description="@string/permdesc_broadcastScoreNetworks"
         android:protectionLevel="signature|system" />
 
-    <!-- Not for use by third-party applications. -->
+    <!-- @SystemApi Not for use by third-party applications. -->
     <permission android:name="android.permission.MASTER_CLEAR"
         android:label="@string/permlab_masterClear"
         android:description="@string/permdesc_masterClear"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows an application to call any phone number, including emergency
+    <!-- @SystemApi Allows an application to call any phone number, including emergency
          numbers, without going through the Dialer user interface for the user
          to confirm the call being placed.
          <p>Not for use by third-party applications. -->
@@ -2337,13 +2337,13 @@
         android:description="@string/permdesc_callPrivileged"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows an application to perform CDMA OTA provisioning @hide -->
+    <!-- @SystemApi Allows an application to perform CDMA OTA provisioning @hide -->
     <permission android:name="android.permission.PERFORM_CDMA_PROVISIONING"
         android:label="@string/permlab_performCdmaProvisioning"
         android:description="@string/permdesc_performCdmaProvisioning"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows enabling/disabling location update notifications from
+    <!-- @SystemApi Allows enabling/disabling location update notifications from
          the radio.
          <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.CONTROL_LOCATION_UPDATES"
@@ -2351,7 +2351,7 @@
         android:description="@string/permdesc_locationUpdates"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows read/write access to the "properties" table in the checkin
+    <!-- @SystemApi Allows read/write access to the "properties" table in the checkin
          database, to change values that get uploaded.
          <p>Not for use by third-party applications. -->
     <permission android:name="android.permission.ACCESS_CHECKIN_PROPERTIES"
@@ -2359,21 +2359,21 @@
         android:description="@string/permdesc_checkinProperties"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows an application to collect component usage
+    <!-- @SystemApi Allows an application to collect component usage
          statistics @hide -->
     <permission android:name="android.permission.PACKAGE_USAGE_STATS"
         android:label="@string/permlab_pkgUsageStats"
         android:description="@string/permdesc_pkgUsageStats"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows an application to collect battery statistics -->
+    <!-- @SystemApi Allows an application to collect battery statistics -->
     <permission android:name="android.permission.BATTERY_STATS"
         android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
         android:label="@string/permlab_batteryStats"
         android:description="@string/permdesc_batteryStats"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows an application to control the backup and restore process.
+    <!-- @SystemApi Allows an application to control the backup and restore process.
     <p>Not for use by third-party applications.
          @hide pending API council -->
     <permission android:name="android.permission.BACKUP"
@@ -2389,14 +2389,14 @@
         android:description="@string/permdesc_confirm_full_backup"
         android:protectionLevel="signature" />
 
-    <!-- Must be required by a {@link android.widget.RemoteViewsService},
+    <!-- @SystemApi Must be required by a {@link android.widget.RemoteViewsService},
          to ensure that only the system can bind to it. -->
     <permission android:name="android.permission.BIND_REMOTEVIEWS"
         android:label="@string/permlab_bindRemoteViews"
         android:description="@string/permdesc_bindRemoteViews"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows an application to tell the AppWidget service which application
+    <!-- @SystemApi Allows an application to tell the AppWidget service which application
          can access AppWidget's data.  The normal user flow is that a user
          picks an AppWidget to go into a particular host, thereby giving that
          host application access to the private data from the AppWidget app.
@@ -2408,14 +2408,14 @@
         android:description="@string/permdesc_bindGadget"
         android:protectionLevel="signature|system" />
 
-    <!-- Private permission, to restrict who can bring up a dialog to add a new
+    <!-- @SystemApi Private permission, to restrict who can bring up a dialog to add a new
          keyguard widget
          @hide -->
     <permission android:name="android.permission.BIND_KEYGUARD_APPWIDGET"
         android:permissionGroup="android.permission-group.PERSONAL_INFO"
         android:protectionLevel="signature|system" />
 
-    <!-- Internal permission allowing an application to query/set which
+    <!-- @SystemApi Internal permission allowing an application to query/set which
          applications can bind AppWidgets.
          @hide -->
     <permission android:name="android.permission.MODIFY_APPWIDGET_BIND_PERMISSIONS"
@@ -2431,7 +2431,7 @@
         android:description="@string/permdesc_changeBackgroundDataSetting"
         android:label="@string/permlab_changeBackgroundDataSetting" />
 
-    <!-- This permission can be used on content providers to allow the global
+    <!-- @SystemApi This permission can be used on content providers to allow the global
          search system to access their data.  Typically it used when the
          provider has some permissions protecting it (which global search
          would not be expected to hold), and added as a read-only permission
@@ -2454,32 +2454,32 @@
         android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
         android:protectionLevel="signature" />
 
-    <!-- Internal permission to allows an application to read indexable data.
+    <!-- @SystemApi Internal permission to allows an application to read indexable data.
         @hide -->
     <permission android:name="android.permission.READ_SEARCH_INDEXABLES"
         android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows applications to set a live wallpaper.
+    <!-- @SystemApi Allows applications to set a live wallpaper.
          @hide XXX Change to signature once the picker is moved to its
          own apk as Ghod Intended. -->
     <permission android:name="android.permission.SET_WALLPAPER_COMPONENT"
         android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows applications to read dream settings and dream state.
+    <!-- @SystemApi Allows applications to read dream settings and dream state.
          @hide -->
     <permission android:name="android.permission.READ_DREAM_STATE"
         android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows applications to write dream settings, and start or stop dreaming.
+    <!-- @SystemApi Allows applications to write dream settings, and start or stop dreaming.
          @hide -->
     <permission android:name="android.permission.WRITE_DREAM_STATE"
         android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
         android:protectionLevel="signature|system" />
 
-    <!-- Allow an application to read and write the cache partition.
+    <!-- @SystemApi Allow an application to read and write the cache partition.
          @hide -->
     <permission android:name="android.permission.ACCESS_CACHE_FILESYSTEM"
         android:label="@string/permlab_cache_filesystem"
@@ -2496,13 +2496,13 @@
         android:description="@string/permlab_copyProtectedData"
         android:protectionLevel="signature" />
 
-    <!-- Internal permission protecting access to the encryption methods
+    <!-- @SystemApi Internal permission protecting access to the encryption methods
         @hide
     -->
     <permission android:name="android.permission.CRYPT_KEEPER"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows an application to read historical network usage for
+    <!-- @SystemApi Allows an application to read historical network usage for
          specific networks and applications. @hide -->
     <permission android:name="android.permission.READ_NETWORK_USAGE_HISTORY"
         android:label="@string/permlab_readNetworkUsageHistory"
@@ -2516,7 +2516,7 @@
         android:description="@string/permdesc_manageNetworkPolicy"
         android:protectionLevel="signature" />
 
-    <!-- Allows an application to account its network traffic against other UIDs. Used
+    <!-- @SystemApi Allows an application to account its network traffic against other UIDs. Used
          by system services like download manager and media server. Not for use by
          third party apps. @hide -->
     <permission android:name="android.permission.MODIFY_NETWORK_ACCOUNTING"
@@ -2524,7 +2524,7 @@
         android:description="@string/permdesc_modifyNetworkAccounting"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows an application to mark traffic as from another user for per user routing.
+    <!-- @SystemApi Allows an application to mark traffic as from another user for per user routing.
          Used by system wide services like media server that execute delegated network connections
          for users.
          @hide
@@ -2541,7 +2541,7 @@
           android:protectionLevel="signature" />
     <uses-permission android:name="android.intent.category.MASTER_CLEAR.permission.C2D_MESSAGE"/>
 
-    <!-- @hide Package verifier needs to have this permission before the PackageManager will
+    <!-- @SystemApi @hide Package verifier needs to have this permission before the PackageManager will
          trust it to verify packages.
     -->
     <permission android:name="android.permission.PACKAGE_VERIFICATION_AGENT"
@@ -2558,7 +2558,7 @@
         android:description="@string/permdesc_bindPackageVerifier"
         android:protectionLevel="signature" />
 
-    <!-- Allows applications to access serial ports via the SerialManager.
+    <!-- @SystemApi Allows applications to access serial ports via the SerialManager.
          @hide -->
     <permission android:name="android.permission.SERIAL_PORT"
         android:label="@string/permlab_serialPort"
@@ -2575,7 +2575,8 @@
         android:label="@string/permlab_accessContentProvidersExternally"
         android:description="@string/permdesc_accessContentProvidersExternally"
         android:protectionLevel="signature" />
-    <!-- Allows an application to hold an UpdateLock, recommending that a headless
+
+    <!-- @SystemApi Allows an application to hold an UpdateLock, recommending that a headless
          OTA reboot *not* occur while the lock is held.
          @hide -->
     <permission android:name="android.permission.UPDATE_LOCK"
@@ -2583,7 +2584,7 @@
         android:description="@string/permdesc_updateLock"
         android:protectionLevel="signatureOrSystem" />
 
-    <!-- Allows an application to read the current set of notifications, including
+    <!-- @SystemApi Allows an application to read the current set of notifications, including
          any metadata and intents attached.
          @hide -->
     <permission android:name="android.permission.ACCESS_NOTIFICATIONS"
@@ -2612,7 +2613,7 @@
                 android:label="@string/permlab_trust_listener"
                 android:description="@string/permdesc_trust_listener" />
 
-    <!-- Allows an application to provide a trust agent.
+    <!-- @SystemApi Allows an application to provide a trust agent.
          @hide For security reasons, this is a platform-only permission. -->
     <permission android:name="android.permission.PROVIDE_TRUST_AGENT"
                 android:protectionLevel="signatureOrSystem"
@@ -2645,7 +2646,7 @@
         android:description="@string/permdesc_bindConditionProviderService"
         android:protectionLevel="signature" />
 
-    <!-- Allows an application to call into a carrier setup flow. It is up to the
+    <!-- @SystemApi Allows an application to call into a carrier setup flow. It is up to the
          carrier setup application to enforce that this permission is required
          @hide This is not a third-party API (intended for OEMs and system apps). -->
     <permission android:name="android.permission.INVOKE_CARRIER_SETUP"
@@ -2653,14 +2654,14 @@
         android:description="@string/permdesc_invokeCarrierSetup"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows an application to listen for network condition observations.
+    <!-- @SystemApi Allows an application to listen for network condition observations.
          @hide This is not a third-party API (intended for system apps). -->
     <permission android:name="android.permission.ACCESS_NETWORK_CONDITIONS"
         android:label="@string/permlab_accessNetworkConditions"
         android:description="@string/permdesc_accessNetworkConditions"
         android:protectionLevel="signature|system" />
 
-    <!-- Allows an application to provision and access DRM certificates
+    <!-- @SystemApi Allows an application to provision and access DRM certificates
          @hide This is not a third-party API (intended for system apps). -->
     <permission android:name="android.permission.ACCESS_DRM_CERTIFICATES"
         android:label="@string/permlab_accessDrmCertificates"
diff --git a/core/res/res/values-large/themes.xml b/core/res/res/values-large/themes.xml
index 448e7c8..8c8f86c 100644
--- a/core/res/res/values-large/themes.xml
+++ b/core/res/res/values-large/themes.xml
@@ -46,4 +46,19 @@
     <style name="Theme.Holo.Light.DialogWhenLarge.NoActionBar"
             parent="@android:style/Theme.Holo.Light.Dialog.NoActionBar.FixedSize">
     </style>
+
+    <style name="Theme.Material.DialogWhenLarge"
+            parent="@android:style/Theme.Material.Dialog.FixedSize">
+        <item name="preferencePanelStyle">@style/PreferencePanel.Dialog</item>
+    </style>
+    <style name="Theme.Material.DialogWhenLarge.NoActionBar"
+            parent="@android:style/Theme.Material.Dialog.NoActionBar.FixedSize">
+        <item name="preferencePanelStyle">@style/PreferencePanel.Dialog</item>
+    </style>
+    <style name="Theme.Material.Light.DialogWhenLarge"
+            parent="@android:style/Theme.Material.Light.Dialog.FixedSize">
+    </style>
+    <style name="Theme.Material.Light.DialogWhenLarge.NoActionBar"
+            parent="@android:style/Theme.Material.Light.Dialog.NoActionBar.FixedSize">
+    </style>
 </resources>
diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml
index 929e615..3d73995 100644
--- a/core/res/res/values/styles_material.xml
+++ b/core/res/res/values/styles_material.xml
@@ -296,8 +296,8 @@
         <item name="textAllCaps">@bool/config_actionMenuItemAllCaps</item>
     </style>
 
-    <style name="TextAppearance.Material.WindowTitle" parent="TextAppearance.Material.Headline" />
-    <style name="TextAppearance.Material.DialogWindowTitle" parent="TextAppearance.Material.Headline" />
+    <style name="TextAppearance.Material.WindowTitle" parent="TextAppearance.Material.Title" />
+    <style name="TextAppearance.Material.DialogWindowTitle" parent="TextAppearance.Material.Title" />
 
     <style name="TextAppearance.Material.CalendarViewWeekDayView" parent="TextAppearance.Material.Small">
         <item name="textStyle">bold</item>
@@ -966,8 +966,6 @@
         <item name="textAppearance">@style/TextAppearance.Material.DialogWindowTitle</item>
     </style>
 
-    <style name="DialogWindowTitle.Material.Light">
-        <item name="textAppearance">@style/TextAppearance.Material.DialogWindowTitle</item>
-    </style>
+    <style name="DialogWindowTitle.Material.Light" />
 
 </resources>
diff --git a/graphics/java/android/graphics/drawable/Ripple.java b/graphics/java/android/graphics/drawable/Ripple.java
index b3187c7..4623fa8 100644
--- a/graphics/java/android/graphics/drawable/Ripple.java
+++ b/graphics/java/android/graphics/drawable/Ripple.java
@@ -236,7 +236,7 @@
         // Cache the paint alpha so we can restore it later.
         final int paintAlpha = p.getAlpha();
 
-        final int outerAlpha = (int) (255 * mOuterOpacity + 0.5f);
+        final int outerAlpha = (int) (paintAlpha * mOuterOpacity + 0.5f);
         if (outerAlpha > 0 && mOuterRadius > 0) {
             p.setAlpha(outerAlpha);
             p.setStyle(Style.FILL);
@@ -244,7 +244,7 @@
             hasContent = true;
         }
 
-        final int alpha = (int) (255 * mOpacity + 0.5f);
+        final int alpha = (int) (paintAlpha * mOpacity + 0.5f);
         final float radius = MathUtils.lerp(0, mOuterRadius, mTweenRadius);
         if (alpha > 0 && radius > 0) {
             final float x = MathUtils.lerp(mStartingX - mBounds.exactCenterX(), mOuterX, mTweenX);
diff --git a/graphics/java/android/graphics/drawable/RippleDrawable.java b/graphics/java/android/graphics/drawable/RippleDrawable.java
index 58f6eaa..e37fbeb 100644
--- a/graphics/java/android/graphics/drawable/RippleDrawable.java
+++ b/graphics/java/android/graphics/drawable/RippleDrawable.java
@@ -172,16 +172,20 @@
     protected boolean onStateChange(int[] stateSet) {
         super.onStateChange(stateSet);
 
+        // TODO: This would make more sense in a StateListDrawable.
         boolean active = false;
+        boolean enabled = false;
         final int N = stateSet.length;
         for (int i = 0; i < N; i++) {
+            if (stateSet[i] == R.attr.state_enabled) {
+                enabled = true;
+            }
             if (stateSet[i] == R.attr.state_focused
                     || stateSet[i] == R.attr.state_pressed) {
                 active = true;
-                break;
             }
         }
-        setActive(active);
+        setActive(active && enabled);
 
         // Update the paint color. Only applicable when animated in software.
         if (mRipplePaint != null && mState.mTint != null) {
@@ -471,16 +475,21 @@
 
     @Override
     public void draw(Canvas canvas) {
-        final Rect bounds = isProjected() ? getDirtyBounds() : getBounds();
+        final boolean isProjected = isProjected();
+        final boolean hasMask = mMask != null;
+        final boolean drawNonMaskContent = mLayerState.mNum > (hasMask ? 1 : 0);
+        final boolean drawMask = hasMask && mMask.getOpacity() != PixelFormat.OPAQUE;
+        final Rect bounds = isProjected ? getDirtyBounds() : getBounds();
 
-        // Draw the content into a layer first.
-        final int contentLayer = drawContentLayer(canvas, bounds, SRC_OVER);
+        // If we have content, draw it into a layer first.
+        final int contentLayer = drawNonMaskContent ?
+                drawContentLayer(canvas, bounds, SRC_OVER) : -1;
 
-        // Next, draw the ripples into a layer.
+        // Next, try to draw the ripples (into a layer if necessary).
         final int rippleLayer = drawRippleLayer(canvas, bounds, mState.mTintXfermode);
 
-        // If we have ripples, draw the masking layer.
-        if (rippleLayer >= 0) {
+        // If we have ripples and a non-opaque mask, draw the masking layer.
+        if (rippleLayer >= 0 && drawMask) {
             drawMaskingLayer(canvas, bounds, DST_IN);
         }
 
@@ -524,17 +533,14 @@
     }
 
     private int drawContentLayer(Canvas canvas, Rect bounds, PorterDuffXfermode mode) {
-        final int count = mLayerState.mNum;
-        if (count == 0 || (mMask != null && count == 1)) {
-            return -1;
-        }
-
+        // TODO: We don't need a layer if all the content is opaque.
         final Paint maskingPaint = getMaskingPaint(mode);
         final int restoreToCount = canvas.saveLayer(bounds.left, bounds.top,
                 bounds.right, bounds.bottom, maskingPaint);
 
         // Draw everything except the mask.
         final ChildDrawable[] array = mLayerState.mChildren;
+        final int count = mLayerState.mNum;
         for (int i = 0; i < count; i++) {
             if (array[i].mId != R.id.mask) {
                 array[i].mDrawable.draw(canvas);
@@ -559,14 +565,15 @@
             rippleARGB = Color.TRANSPARENT;
         }
 
-        final int rippleAlpha = Color.alpha(rippleARGB);
-        final int rippleColor = rippleARGB | (0xFF << 24);
         if (mRipplePaint == null) {
             mRipplePaint = new Paint();
             mRipplePaint.setAntiAlias(true);
         }
+
+        final int rippleAlpha = Color.alpha(rippleARGB);
         final Paint ripplePaint = mRipplePaint;
-        ripplePaint.setColor(rippleColor);
+        ripplePaint.setColor(rippleARGB);
+        ripplePaint.setAlpha(0xFF);
 
         boolean drewRipples = false;
         int restoreToCount = -1;
@@ -584,7 +591,6 @@
                 maskingPaint.setAlpha(rippleAlpha);
                 restoreToCount = canvas.saveLayer(bounds.left, bounds.top,
                         bounds.right, bounds.bottom, maskingPaint);
-                maskingPaint.setAlpha(255);
 
                 restoreTranslate = canvas.save();
                 // Translate the canvas to the current hotspot bounds.
@@ -609,18 +615,13 @@
     }
 
     private int drawMaskingLayer(Canvas canvas, Rect bounds, PorterDuffXfermode mode) {
-        final Drawable mask = mMask;
-        if (mask == null) {
-            return -1;
-        }
-
         final int restoreToCount = canvas.saveLayer(bounds.left, bounds.top,
                 bounds.right, bounds.bottom, getMaskingPaint(mode));
 
         // Ensure that DST_IN blends using the entire layer.
         canvas.drawColor(Color.TRANSPARENT);
 
-        mask.draw(canvas);
+        mMask.draw(canvas);
 
         return restoreToCount;
     }
@@ -630,6 +631,7 @@
             mMaskingPaint = new Paint();
         }
         mMaskingPaint.setXfermode(xfermode);
+        mMaskingPaint.setAlpha(0xFF);
         return mMaskingPaint;
     }
 
diff --git a/packages/DocumentsUI/AndroidManifest.xml b/packages/DocumentsUI/AndroidManifest.xml
index 159ee66..3861cc1 100644
--- a/packages/DocumentsUI/AndroidManifest.xml
+++ b/packages/DocumentsUI/AndroidManifest.xml
@@ -32,7 +32,7 @@
                 <data android:mimeType="*/*" />
             </intent-filter>
             <intent-filter>
-                <action android:name="android.intent.action.PICK_DIRECTORY" />
+                <action android:name="android.intent.action.OPEN_DOCUMENT_TREE" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <intent-filter>
diff --git a/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java b/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java
index 9f76991..d0b6a1d 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/DocumentsActivity.java
@@ -24,7 +24,7 @@
 import static com.android.documentsui.DocumentsActivity.State.ACTION_GET_CONTENT;
 import static com.android.documentsui.DocumentsActivity.State.ACTION_MANAGE;
 import static com.android.documentsui.DocumentsActivity.State.ACTION_OPEN;
-import static com.android.documentsui.DocumentsActivity.State.ACTION_PICK_DIRECTORY;
+import static com.android.documentsui.DocumentsActivity.State.ACTION_OPEN_TREE;
 import static com.android.documentsui.DocumentsActivity.State.MODE_GRID;
 import static com.android.documentsui.DocumentsActivity.State.MODE_LIST;
 
@@ -203,7 +203,7 @@
             final String mimeType = getIntent().getType();
             final String title = getIntent().getStringExtra(Intent.EXTRA_TITLE);
             SaveFragment.show(getFragmentManager(), mimeType, title);
-        } else if (mState.action == ACTION_PICK_DIRECTORY) {
+        } else if (mState.action == ACTION_OPEN_TREE) {
             PickFragment.show(getFragmentManager());
         }
 
@@ -213,7 +213,7 @@
             moreApps.setPackage(null);
             RootsFragment.show(getFragmentManager(), moreApps);
         } else if (mState.action == ACTION_OPEN || mState.action == ACTION_CREATE
-                || mState.action == ACTION_PICK_DIRECTORY) {
+                || mState.action == ACTION_OPEN_TREE) {
             RootsFragment.show(getFragmentManager(), null);
         }
 
@@ -240,8 +240,8 @@
             mState.action = ACTION_CREATE;
         } else if (Intent.ACTION_GET_CONTENT.equals(action)) {
             mState.action = ACTION_GET_CONTENT;
-        } else if (Intent.ACTION_PICK_DIRECTORY.equals(action)) {
-            mState.action = ACTION_PICK_DIRECTORY;
+        } else if (Intent.ACTION_OPEN_DOCUMENT_TREE.equals(action)) {
+            mState.action = ACTION_OPEN_TREE;
         } else if (DocumentsContract.ACTION_MANAGE_ROOT.equals(action)) {
             mState.action = ACTION_MANAGE;
         }
@@ -441,7 +441,7 @@
             actionBar.setIcon(new ColorDrawable());
 
             if (mState.action == ACTION_OPEN || mState.action == ACTION_GET_CONTENT
-                    || mState.action == ACTION_PICK_DIRECTORY) {
+                    || mState.action == ACTION_OPEN_TREE) {
                 actionBar.setTitle(R.string.title_open);
             } else if (mState.action == ACTION_CREATE) {
                 actionBar.setTitle(R.string.title_save);
@@ -583,7 +583,7 @@
         sortSize.setVisible(mState.showSize);
 
         final boolean searchVisible;
-        if (mState.action == ACTION_CREATE || mState.action == ACTION_PICK_DIRECTORY) {
+        if (mState.action == ACTION_CREATE || mState.action == ACTION_OPEN_TREE) {
             createDir.setVisible(cwd != null && cwd.isCreateSupported());
             searchVisible = false;
 
@@ -828,7 +828,7 @@
 
         if (cwd == null) {
             // No directory means recents
-            if (mState.action == ACTION_CREATE || mState.action == ACTION_PICK_DIRECTORY) {
+            if (mState.action == ACTION_CREATE || mState.action == ACTION_OPEN_TREE) {
                 RecentsCreateFragment.show(fm);
             } else {
                 DirectoryFragment.showRecentsOpen(fm, anim);
@@ -857,7 +857,7 @@
             }
         }
 
-        if (mState.action == ACTION_PICK_DIRECTORY) {
+        if (mState.action == ACTION_OPEN_TREE) {
             final PickFragment pick = PickFragment.get(fm);
             if (pick != null) {
                 final CharSequence displayName = (mState.stack.size() <= 1) ? root.title
@@ -1021,7 +1021,7 @@
     }
 
     public void onPickRequested(DocumentInfo pickTarget) {
-        final Uri viaUri = DocumentsContract.buildViaUri(pickTarget.authority,
+        final Uri viaUri = DocumentsContract.buildTreeDocumentUri(pickTarget.authority,
                 pickTarget.documentId);
         new PickFinishTask(viaUri).executeOnExecutor(getCurrentExecutor());
     }
@@ -1031,7 +1031,7 @@
         final ContentValues values = new ContentValues();
 
         final byte[] rawStack = DurableUtils.writeToArrayOrNull(mState.stack);
-        if (mState.action == ACTION_CREATE || mState.action == ACTION_PICK_DIRECTORY) {
+        if (mState.action == ACTION_CREATE || mState.action == ACTION_OPEN_TREE) {
             // Remember stack for last create
             values.clear();
             values.put(RecentColumns.KEY, mState.stack.buildKey());
@@ -1064,7 +1064,7 @@
 
         if (mState.action == ACTION_GET_CONTENT) {
             intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
-        } else if (mState.action == ACTION_PICK_DIRECTORY) {
+        } else if (mState.action == ACTION_OPEN_TREE) {
             intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION
                     | Intent.FLAG_GRANT_WRITE_URI_PERMISSION
                     | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION
@@ -1202,7 +1202,7 @@
         public static final int ACTION_OPEN = 1;
         public static final int ACTION_CREATE = 2;
         public static final int ACTION_GET_CONTENT = 3;
-        public static final int ACTION_PICK_DIRECTORY = 4;
+        public static final int ACTION_OPEN_TREE = 4;
         public static final int ACTION_MANAGE = 5;
 
         public static final int MODE_UNKNOWN = 0;
diff --git a/packages/DocumentsUI/src/com/android/documentsui/PickFragment.java b/packages/DocumentsUI/src/com/android/documentsui/PickFragment.java
index a9e488a1..5112c92 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/PickFragment.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/PickFragment.java
@@ -77,13 +77,15 @@
     public void setPickTarget(DocumentInfo pickTarget, CharSequence displayName) {
         mPickTarget = pickTarget;
 
-        if (mPickTarget != null) {
-            mContainer.setVisibility(View.VISIBLE);
-            final Locale locale = getResources().getConfiguration().locale;
-            final String raw = getString(R.string.menu_select).toUpperCase(locale);
-            mPick.setText(TextUtils.expandTemplate(raw, displayName));
-        } else {
-            mContainer.setVisibility(View.GONE);
+        if (mContainer != null) {
+            if (mPickTarget != null) {
+                mContainer.setVisibility(View.VISIBLE);
+                final Locale locale = getResources().getConfiguration().locale;
+                final String raw = getString(R.string.menu_select).toUpperCase(locale);
+                mPick.setText(TextUtils.expandTemplate(raw, displayName));
+            } else {
+                mContainer.setVisibility(View.GONE);
+            }
         }
     }
 }
diff --git a/packages/DocumentsUI/src/com/android/documentsui/RootsCache.java b/packages/DocumentsUI/src/com/android/documentsui/RootsCache.java
index 933dbe0..caa7581 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/RootsCache.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/RootsCache.java
@@ -105,7 +105,7 @@
         mRecentsRoot.rootId = null;
         mRecentsRoot.icon = R.drawable.ic_root_recent;
         mRecentsRoot.flags = Root.FLAG_LOCAL_ONLY | Root.FLAG_SUPPORTS_CREATE
-                | Root.FLAG_SUPPORTS_DIR_SELECTION;
+                | Root.FLAG_SUPPORTS_IS_CHILD;
         mRecentsRoot.title = mContext.getString(R.string.root_recent);
         mRecentsRoot.availableBytes = -1;
 
@@ -350,7 +350,7 @@
         final List<RootInfo> matching = Lists.newArrayList();
         for (RootInfo root : roots) {
             final boolean supportsCreate = (root.flags & Root.FLAG_SUPPORTS_CREATE) != 0;
-            final boolean supportsDir = (root.flags & Root.FLAG_SUPPORTS_DIR_SELECTION) != 0;
+            final boolean supportsIsChild = (root.flags & Root.FLAG_SUPPORTS_IS_CHILD) != 0;
             final boolean advanced = (root.flags & Root.FLAG_ADVANCED) != 0;
             final boolean localOnly = (root.flags & Root.FLAG_LOCAL_ONLY) != 0;
             final boolean empty = (root.flags & Root.FLAG_EMPTY) != 0;
@@ -358,7 +358,7 @@
             // Exclude read-only devices when creating
             if (state.action == State.ACTION_CREATE && !supportsCreate) continue;
             // Exclude roots that don't support directory picking
-            if (state.action == State.ACTION_PICK_DIRECTORY && !supportsDir) continue;
+            if (state.action == State.ACTION_OPEN_TREE && !supportsIsChild) continue;
             // Exclude advanced devices when not requested
             if (!state.showAdvanced && advanced) continue;
             // Exclude non-local devices when local only
diff --git a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java
index d388ab7..9473eb9 100644
--- a/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java
+++ b/packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java
@@ -145,7 +145,7 @@
                 final RootInfo root = new RootInfo();
                 root.rootId = rootId;
                 root.flags = Root.FLAG_SUPPORTS_CREATE | Root.FLAG_LOCAL_ONLY | Root.FLAG_ADVANCED
-                        | Root.FLAG_SUPPORTS_SEARCH | Root.FLAG_SUPPORTS_DIR_SELECTION;
+                        | Root.FLAG_SUPPORTS_SEARCH | Root.FLAG_SUPPORTS_IS_CHILD;
                 if (ROOT_ID_PRIMARY_EMULATED.equals(rootId)) {
                     root.title = getContext().getString(R.string.root_internal_storage);
                 } else {
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 68bf628..949bc5d 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -16,7 +16,7 @@
 
 package android.telephony;
 
-import android.annotation.PrivateApi;
+import android.annotation.SystemApi;
 import android.annotation.SdkConstant;
 import android.annotation.SdkConstant.SdkConstantType;
 import android.content.ComponentName;
@@ -1743,11 +1743,11 @@
     }
 
     /**
-     * Expose the rest of ITelephony to @PrivateApi
+     * Expose the rest of ITelephony to @SystemApi
      */
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public void dial(String number) {
         try {
             getITelephony().dial(number);
@@ -1757,7 +1757,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public void call(String callingPackage, String number) {
         try {
             getITelephony().call(callingPackage, number);
@@ -1767,7 +1767,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public boolean showCallScreen() {
         try {
             getTelecommService().showCallScreen(false);
@@ -1779,7 +1779,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public boolean showCallScreenWithDialpad(boolean showDialpad) {
         try {
             getTelecommService().showCallScreen(showDialpad);
@@ -1791,7 +1791,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public boolean endCall() {
         try {
             return getITelephony().endCall();
@@ -1802,7 +1802,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public void answerRingingCall() {
         try {
             getITelephony().answerRingingCall();
@@ -1812,7 +1812,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public void silenceRinger() {
         try {
             getTelecommService().silenceRinger();
@@ -1822,7 +1822,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public boolean isOffhook() {
         try {
             return getITelephony().isOffhook();
@@ -1833,7 +1833,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public boolean isRinging() {
         try {
             return getITelephony().isRinging();
@@ -1844,7 +1844,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public boolean isIdle() {
         try {
             return getITelephony().isIdle();
@@ -1855,7 +1855,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public boolean isRadioOn() {
         try {
             return getITelephony().isRadioOn();
@@ -1866,7 +1866,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public boolean isSimPinEnabled() {
         try {
             return getITelephony().isSimPinEnabled();
@@ -1877,7 +1877,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public void cancelMissedCallsNotification() {
         try {
             getITelephony().cancelMissedCallsNotification();
@@ -1887,7 +1887,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public boolean supplyPin(String pin) {
         try {
             return getITelephony().supplyPin(pin);
@@ -1898,7 +1898,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public boolean supplyPuk(String puk, String pin) {
         try {
             return getITelephony().supplyPuk(puk, pin);
@@ -1909,7 +1909,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public int[] supplyPinReportResult(String pin) {
         try {
             return getITelephony().supplyPinReportResult(pin);
@@ -1920,7 +1920,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public int[] supplyPukReportResult(String puk, String pin) {
         try {
             return getITelephony().supplyPukReportResult(puk, pin);
@@ -1931,7 +1931,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public boolean handlePinMmi(String dialString) {
         try {
             return getITelephony().handlePinMmi(dialString);
@@ -1942,7 +1942,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public void toggleRadioOnOff() {
         try {
             getITelephony().toggleRadioOnOff();
@@ -1952,7 +1952,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public boolean setRadio(boolean turnOn) {
         try {
             return getITelephony().setRadio(turnOn);
@@ -1963,7 +1963,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public boolean setRadioPower(boolean turnOn) {
         try {
             return getITelephony().setRadioPower(turnOn);
@@ -1974,7 +1974,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public void updateServiceLocation() {
         try {
             getITelephony().updateServiceLocation();
@@ -1984,7 +1984,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public int enableApnType(String type) {
         try {
             return getITelephony().enableApnType(type);
@@ -1995,7 +1995,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public int disableApnType(String type) {
         try {
             return getITelephony().disableApnType(type);
@@ -2006,7 +2006,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public boolean enableDataConnectivity() {
         try {
             return getITelephony().enableDataConnectivity();
@@ -2017,7 +2017,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public boolean disableDataConnectivity() {
         try {
             return getITelephony().disableDataConnectivity();
@@ -2028,7 +2028,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public boolean isDataConnectivityPossible() {
         try {
             return getITelephony().isDataConnectivityPossible();
@@ -2039,7 +2039,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public boolean needsOtaServiceProvisioning() {
         try {
             return getITelephony().needsOtaServiceProvisioning();
@@ -2050,7 +2050,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public void setDataEnabled(boolean enable) {
         try {
             getITelephony().setDataEnabled(enable);
@@ -2060,7 +2060,7 @@
     }
 
     /** @hide */
-    @PrivateApi
+    @SystemApi
     public boolean getDataEnabled() {
         try {
             return getITelephony().getDataEnabled();
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index e599643..f10904c 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -166,6 +166,35 @@
     ResTable_config mParams;
 };
 
+class AnnotationProcessor {
+public:
+    AnnotationProcessor() : mDeprecated(false), mSystemApi(false) { }
+
+    void preprocessComment(String8& comment) {
+        if (comment.size() > 0) {
+            if (comment.contains("@deprecated")) {
+                mDeprecated = true;
+            }
+            if (comment.removeAll("@SystemApi")) {
+                mSystemApi = true;
+            }
+        }
+    }
+
+    void printAnnotations(FILE* fp, const char* indentStr) {
+        if (mDeprecated) {
+            fprintf(fp, "%s@Deprecated\n", indentStr);
+        }
+        if (mSystemApi) {
+            fprintf(fp, "%s@android.annotation.SystemApi\n", indentStr);
+        }
+    }
+
+private:
+    bool mDeprecated;
+    bool mSystemApi;
+};
+
 // ==========================================================================
 // ==========================================================================
 // ==========================================================================
@@ -1742,16 +1771,13 @@
 
         NA = idents.size();
 
-        bool deprecated = false;
-        
         String16 comment = symbols->getComment(realClassName);
+        AnnotationProcessor ann;
         fprintf(fp, "%s/** ", indentStr);
         if (comment.size() > 0) {
             String8 cmt(comment);
+            ann.preprocessComment(cmt);
             fprintf(fp, "%s\n", cmt.string());
-            if (strstr(cmt.string(), "@deprecated") != NULL) {
-                deprecated = true;
-            }
         } else {
             fprintf(fp, "Attributes that can be used with a %s.\n", nclassName.string());
         }
@@ -1823,9 +1849,7 @@
         }
         fprintf(fp, "%s */\n", getIndentSpace(indent));
 
-        if (deprecated) {
-            fprintf(fp, "%s@Deprecated\n", indentStr);
-        }
+        ann.printAnnotations(fp, indentStr);
         
         fprintf(fp,
                 "%spublic static final int[] %s = {\n"
@@ -1871,17 +1895,14 @@
                 //printf("%s:%s/%s: 0x%08x\n", String8(package16).string(),
                 //    String8(attr16).string(), String8(name16).string(), typeSpecFlags);
                 const bool pub = (typeSpecFlags&ResTable_typeSpec::SPEC_PUBLIC) != 0;
-                
-                bool deprecated = false;
-                
+
+                AnnotationProcessor ann;
                 fprintf(fp, "%s/**\n", indentStr);
                 if (comment.size() > 0) {
                     String8 cmt(comment);
+                    ann.preprocessComment(cmt);
                     fprintf(fp, "%s  <p>\n%s  @attr description\n", indentStr, indentStr);
                     fprintf(fp, "%s  %s\n", indentStr, cmt.string());
-                    if (strstr(cmt.string(), "@deprecated") != NULL) {
-                        deprecated = true;
-                    }
                 } else {
                     fprintf(fp,
                             "%s  <p>This symbol is the offset where the {@link %s.R.attr#%s}\n"
@@ -1893,10 +1914,8 @@
                 }
                 if (typeComment.size() > 0) {
                     String8 cmt(typeComment);
+                    ann.preprocessComment(cmt);
                     fprintf(fp, "\n\n%s  %s\n", indentStr, cmt.string());
-                    if (strstr(cmt.string(), "@deprecated") != NULL) {
-                        deprecated = true;
-                    }
                 }
                 if (comment.size() > 0) {
                     if (pub) {
@@ -1915,9 +1934,7 @@
                         getSymbolPackage(name8, assets, pub).string(),
                         getSymbolName(name8).string());
                 fprintf(fp, "%s*/\n", indentStr);
-                if (deprecated) {
-                    fprintf(fp, "%s@Deprecated\n", indentStr);
-                }
+                ann.printAnnotations(fp, indentStr);
                 fprintf(fp,
                         "%spublic static final int %s_%s = %d;\n",
                         indentStr, nclassName.string(),
@@ -2056,16 +2073,14 @@
         String8 name8(sym.name);
         String16 comment(sym.comment);
         bool haveComment = false;
-        bool deprecated = false;
+        AnnotationProcessor ann;
         if (comment.size() > 0) {
             haveComment = true;
             String8 cmt(comment);
+            ann.preprocessComment(cmt);
             fprintf(fp,
                     "%s/** %s\n",
                     getIndentSpace(indent), cmt.string());
-            if (strstr(cmt.string(), "@deprecated") != NULL) {
-                deprecated = true;
-            }
         } else if (sym.isPublic && !includePrivate) {
             sym.sourcePos.warning("No comment for public symbol %s:%s/%s",
                 assets->getPackage().string(), className.string(),
@@ -2074,6 +2089,7 @@
         String16 typeComment(sym.typeComment);
         if (typeComment.size() > 0) {
             String8 cmt(typeComment);
+            ann.preprocessComment(cmt);
             if (!haveComment) {
                 haveComment = true;
                 fprintf(fp,
@@ -2082,16 +2098,11 @@
                 fprintf(fp,
                         "%s %s\n", getIndentSpace(indent), cmt.string());
             }
-            if (strstr(cmt.string(), "@deprecated") != NULL) {
-                deprecated = true;
-            }
         }
         if (haveComment) {
             fprintf(fp,"%s */\n", getIndentSpace(indent));
         }
-        if (deprecated) {
-            fprintf(fp, "%s@Deprecated\n", getIndentSpace(indent));
-        }
+        ann.printAnnotations(fp, getIndentSpace(indent));
         fprintf(fp, id_format,
                 getIndentSpace(indent),
                 flattenSymbol(name8).string(), (int)sym.int32Val);
@@ -2107,25 +2118,21 @@
         }
         String8 name8(sym.name);
         String16 comment(sym.comment);
-        bool deprecated = false;
+        AnnotationProcessor ann;
         if (comment.size() > 0) {
             String8 cmt(comment);
+            ann.preprocessComment(cmt);
             fprintf(fp,
                     "%s/** %s\n"
                      "%s */\n",
                     getIndentSpace(indent), cmt.string(),
                     getIndentSpace(indent));
-            if (strstr(cmt.string(), "@deprecated") != NULL) {
-                deprecated = true;
-            }
         } else if (sym.isPublic && !includePrivate) {
             sym.sourcePos.warning("No comment for public symbol %s:%s/%s",
                 assets->getPackage().string(), className.string(),
                 String8(sym.name).string());
         }
-        if (deprecated) {
-            fprintf(fp, "%s@Deprecated\n", getIndentSpace(indent));
-        }
+        ann.printAnnotations(fp, getIndentSpace(indent));
         fprintf(fp, "%spublic static final String %s=\"%s\";\n",
                 getIndentSpace(indent),
                 flattenSymbol(name8).string(), sym.stringVal.string());