Merge "Use DPM's counter for invalid password attempts" into pi-dev
diff --git a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
index ed684d7..ecf6f12 100644
--- a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
+++ b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
@@ -29,7 +29,6 @@
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.hardware.fingerprint.FingerprintManager;
-import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
@@ -189,12 +188,10 @@
* content and also the accessibility service will receive accessibility events from
* them.
* <p>
- * <strong>Note:</strong> For accessibility services targeting API version
- * {@link Build.VERSION_CODES#JELLY_BEAN} or higher this flag has to be explicitly
- * set for the system to regard views that are not important for accessibility. For
- * accessibility services targeting API version lower than
- * {@link Build.VERSION_CODES#JELLY_BEAN} this flag is ignored and all views are
- * regarded for accessibility purposes.
+ * <strong>Note:</strong> For accessibility services targeting Android 4.1 (API level 16) or
+ * higher, this flag has to be explicitly set for the system to regard views that are not
+ * important for accessibility. For accessibility services targeting Android 4.0.4 (API level
+ * 15) or lower, this flag is ignored and all views are regarded for accessibility purposes.
* </p>
* <p>
* Usually views not important for accessibility are layout managers that do not
@@ -219,19 +216,19 @@
* flag does not guarantee that the device will not be in touch exploration
* mode since there may be another enabled service that requested it.
* <p>
- * For accessibility services targeting API version higher than
- * {@link Build.VERSION_CODES#JELLY_BEAN_MR1} that want to set
- * this flag have to declare this capability in their meta-data by setting
- * the attribute {@link android.R.attr#canRequestTouchExplorationMode
- * canRequestTouchExplorationMode} to true, otherwise this flag will
+ * For accessibility services targeting Android 4.3 (API level 18) or higher
+ * that want to set this flag have to declare this capability in their
+ * meta-data by setting the attribute
+ * {@link android.R.attr#canRequestTouchExplorationMode
+ * canRequestTouchExplorationMode} to true. Otherwise, this flag will
* be ignored. For how to declare the meta-data of a service refer to
* {@value AccessibilityService#SERVICE_META_DATA}.
* </p>
* <p>
- * Services targeting API version equal to or lower than
- * {@link Build.VERSION_CODES#JELLY_BEAN_MR1} will work normally, i.e.
- * the first time they are run, if this flag is specified, a dialog is
- * shown to the user to confirm enabling explore by touch.
+ * Services targeting Android 4.2.2 (API level 17) or lower will work
+ * normally. In other words, the first time they are run, if this flag is
+ * specified, a dialog is shown to the user to confirm enabling explore by
+ * touch.
* </p>
* @see android.R.styleable#AccessibilityService_canRequestTouchExplorationMode
*/
@@ -387,10 +384,10 @@
public int feedbackType;
/**
- * The timeout after the most recent event of a given type before an
+ * The timeout, in milliseconds, after the most recent event of a given type before an
* {@link AccessibilityService} is notified.
* <p>
- * <strong>Can be dynamically set at runtime.</strong>.
+ * <strong>Can be dynamically set at runtime.</strong>
* </p>
* <p>
* <strong>Note:</strong> The event notification timeout is useful to avoid propagating
diff --git a/core/java/android/app/assist/AssistStructure.java b/core/java/android/app/assist/AssistStructure.java
index d568662..dd61f28 100644
--- a/core/java/android/app/assist/AssistStructure.java
+++ b/core/java/android/app/assist/AssistStructure.java
@@ -41,18 +41,23 @@
import java.util.List;
/**
- * Assist data automatically created by the platform's implementation of assist and autofill.
+ * <p>This API automatically creates assist data from the platform's
+ * implementation of assist and autofill.
*
* <p>The structure is used for assist purposes when created by
* {@link android.app.Activity#onProvideAssistData}, {@link View#onProvideStructure(ViewStructure)},
* or {@link View#onProvideVirtualStructure(ViewStructure)}.
*
- * <p>The structure is used for autofill purposes when created by
+ * <p>The structure is also used for autofill purposes when created by
* {@link View#onProvideAutofillStructure(ViewStructure, int)},
* or {@link View#onProvideAutofillVirtualStructure(ViewStructure, int)}.
*
- * <p>For performance reasons, some properties of the assist data might be available just for assist
- * or autofill purposes; in those case, the property availability will be document in its javadoc.
+ * <p>For performance reasons, some properties of the assist data might only be available for
+ * assist or autofill purposes. In those cases, a property's availability will be documented
+ * in its javadoc.
+ *
+ * <p>To learn about using Autofill in your app, read the
+ * <a href="/guide/topics/text/autofill">Autofill Framework</a> guides.
*/
public class AssistStructure implements Parcelable {
static final String TAG = "AssistStructure";
diff --git a/core/java/android/content/pm/ShortcutManager.java b/core/java/android/content/pm/ShortcutManager.java
index 25e0ccd..36849e6 100644
--- a/core/java/android/content/pm/ShortcutManager.java
+++ b/core/java/android/content/pm/ShortcutManager.java
@@ -20,7 +20,6 @@
import android.annotation.SystemService;
import android.annotation.TestApi;
import android.annotation.UserIdInt;
-import android.app.Activity;
import android.app.usage.UsageStatsManager;
import android.content.Context;
import android.content.Intent;
@@ -29,256 +28,23 @@
import android.os.Build.VERSION_CODES;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.os.UserHandle;
import com.android.internal.annotations.VisibleForTesting;
import java.util.List;
/**
- * The ShortcutManager performs operations on an app's set of <em>shortcuts</em>. The
- * {@link ShortcutInfo} class contains information about each of the shortcuts themselves.
+ * <p><code>ShortcutManager</code> executes operations on an app's set of <i>shortcuts</i>, which
+ * represent specific tasks and actions that users can perform within your app. This page lists
+ * components of the <code>ShortcutManager</code> class that you can use to create and manage
+ * sets of shortcuts.
*
- * <p>An app's shortcuts represent specific tasks and actions that users can perform within your
- * app. When a user selects a shortcut in the currently-active launcher, your app opens an activity
- * other than the app's starting activity, provided that the currently-active launcher supports app
- * shortcuts.</p>
+ * <p>To learn about methods that retrieve information about a single shortcut—including
+ * identifiers, type, and status—read the <code>
+ * <a href="/reference/android/content/pm/ShortcutInfo.html">ShortcutInfo</a></code> reference.
*
- * <p>The types of shortcuts that you create for your app depend on the app's key use cases. For
- * example, an email app may publish the "compose new email" shortcut, which allows the app to
- * directly open the compose activity.</p>
- *
- * <p class="note"><b>Note:</b> Only main activities—activities that handle the
- * {@link Intent#ACTION_MAIN} action and the {@link Intent#CATEGORY_LAUNCHER} category—can
- * have shortcuts. If an app has multiple main activities, you need to define the set of shortcuts
- * for <em>each</em> activity.
- *
- * <p>This page discusses the implementation details of the <code>ShortcutManager</code> class. For
- * definitions of key terms and guidance on performing operations on shortcuts within your app, see
- * the <a href="/guide/topics/ui/shortcuts.html">App Shortcuts</a> feature guide.
- *
- * <h3>Shortcut characteristics</h3>
- *
- * This section describes in-depth details about each shortcut type's usage and availability.
- *
- * <p class="note"><b>Important security note:</b> All shortcut information is stored in
- * <a href="/training/articles/direct-boot.html">credential encrypted storage</a>, so your app
- * cannot access a user's shortcuts until after they've unlocked the device.
- *
- * <h4>Static and dynamic shortcuts</h4>
- *
- * <p>Static shortcuts and dynamic shortcuts are shown in a supported launcher when the user
- * performs a specific gesture. On currently-supported launchers, the gesture is a long-press on the
- * app's launcher icon, but the actual gesture may be different on other launcher apps.
- *
- * <p>The {@link LauncherApps} class provides APIs for launcher apps to access shortcuts.
- *
- * <h4>Pinned shortcuts</h4>
- *
- * <p>Because pinned shortcuts appear in the launcher itself, they're always visible. A pinned
- * shortcut is removed from the launcher only in the following situations:
- * <ul>
- * <li>The user removes it.
- * <li>The publisher app associated with the shortcut is uninstalled.
- * <li>The user selects <b>Clear data</b> from the publisher app's <i>Storage</i> screen, within
- * the system's <b>Settings</b> app.
- * </ul>
- *
- * <p>Because the system performs
- * <a href="/guide/topics/ui/shortcuts.html#backup-and-restore">backup and restore</a> on pinned
- * shortcuts automatically, these shortcuts' IDs should contain either stable, constant strings or
- * server-side identifiers, rather than identifiers generated locally that might not make sense on
- * other devices.
- *
- * <h3>Shortcut display order</h3>
- *
- * <p>When the launcher displays an app's shortcuts, they should appear in the following order:
- *
- * <ol>
- * <li><b>Static shortcuts:</b> Shortcuts whose {@link ShortcutInfo#isDeclaredInManifest()} method
- * returns {@code true}.</li>
- * <li><b>Dynamic shortcuts:</b> Shortcuts whose {@link ShortcutInfo#isDynamic()} method returns
- * {@code true}.</li>
- * </ol>
- *
- * <p>Within each shortcut type (static and dynamic), shortcuts are sorted in order of increasing
- * rank according to {@link ShortcutInfo#getRank()}.</p>
- *
- * <h4>Shortcut ranks</h4>
- *
- * <p>Shortcut ranks are non-negative, sequential integers that determine the order in which
- * shortcuts appear, assuming that the shortcuts are all in the same category. You can update ranks
- * of existing shortcuts when you call {@link #updateShortcuts(List)},
- * {@link #addDynamicShortcuts(List)}, or {@link #setDynamicShortcuts(List)}.
- *
- * <p class="note"><b>Note:</b> Ranks are auto-adjusted so that they're unique for each type of
- * shortcut (static or dynamic). For example, if there are 3 dynamic shortcuts with ranks 0, 1 and
- * 2, adding another dynamic shortcut with a rank of 1 represents a request to place this shortcut
- * at the second position. In response, the third and fourth shortcuts move closer to the bottom of
- * the shortcut list, with their ranks changing to 2 and 3, respectively.
- *
- * <h3>Options for static shortcuts</h3>
- *
- * The following list includes descriptions for the different attributes within a static shortcut.
- * You must provide a value for {@code android:shortcutId} and {@code android:shortcutShortLabel};
- * all other values are optional.
- *
- * <dl>
- * <dt>{@code android:shortcutId}</dt>
- * <dd><p>A string literal, which represents the shortcut when a {@code ShortcutManager} object
- * performs operations on it.</p>
- * <p class="note"><b>Note: </b>You cannot set this attribute's value to a resource string, such
- * as <code>@string/foo</code>.</p>
- * </dd>
- *
- * <dt>{@code android:enabled}</dt>
- * <dd><p>Whether the user can interact with the shortcut from a supported launcher.</p>
- * <p>The default value is {@code true}. If you set it to {@code false}, you should also set
- * {@code android:shortcutDisabledMessage} to a message that explains why you've disabled the
- * shortcut. If you don't think you need to provide such a message, it's easiest to just remove
- * the shortcut from the XML file entirely, rather than changing the values of the shortcut's
- * {@code android:enabled} and {@code android:shortcutDisabledMessage} attributes.
- * </dd>
- *
- * <dt>{@code android:icon}</dt>
- * <dd><p>The <a href="/topic/performance/graphics/index.html">bitmap</a> or
- * <a href="/guide/practices/ui_guidelines/icon_design_adaptive.html">adaptive icon</a> that the
- * launcher uses when displaying the shortcut to the user. This value can be either the path to an
- * image or the resource file that contains the image. Use adaptive icons whenever possible to
- * improve performance and consistency.</p>
- * <p class="note"><b>Note: </b>Shortcut icons cannot include
- * <a href="/training/material/drawables.html#DrawableTint">tints</a>.
- * </dd>
- *
- * <dt>{@code android:shortcutShortLabel}</dt>
- * <dd><p>A concise phrase that describes the shortcut's purpose. For more information, see
- * {@link ShortcutInfo.Builder#setShortLabel(CharSequence)}.</p>
- * <p class="note"><b>Note: </b>This attribute's value must be a resource string, such as
- * <code>@string/shortcut_short_label</code>.</p>
- * </dd>
- *
- * <dt>{@code android:shortcutLongLabel}</dt>
- * <dd><p>An extended phrase that describes the shortcut's purpose. If there's enough space, the
- * launcher displays this value instead of {@code android:shortcutShortLabel}. For more
- * information, see {@link ShortcutInfo.Builder#setLongLabel(CharSequence)}.</p>
- * <p class="note"><b>Note: </b>This attribute's value must be a resource string, such as
- * <code>@string/shortcut_long_label</code>.</p>
- * </dd>
- *
- * <dt>{@code android:shortcutDisabledMessage}</dt>
- * <dd><p>The message that appears in a supported launcher when the user attempts to launch a
- * disabled shortcut. The message should explain to the user why the shortcut is now disabled.
- * This attribute's value has no effect if {@code android:enabled} is {@code true}.</p>
- * <p class="note"><b>Note: </b>This attribute's value must be a resource string, such as
- * <code>@string/shortcut_disabled_message</code>.</p>
- * </dd>
- * </dl>
- *
- * <h3>Inner elements that define static shortcuts</h3>
- *
- * <p>The XML file that lists an app's static shortcuts supports the following elements inside each
- * {@code <shortcut>} element. You must include an {@code intent} inner element for each
- * static shortcut that you define.</p>
- *
- * <dl>
- * <dt>{@code intent}</dt>
- * <dd><p>The action that the system launches when the user selects the shortcut. This intent must
- * provide a value for the {@code android:action} attribute.</p>
- * <p>You can provide multiple intents for a single shortcut. If you do so, the last defined
- * activity is launched, and the other activities are placed in the
- * <a href="/guide/components/tasks-and-back-stack.html">back stack</a>. See
- * <a href="/guide/topics/ui/shortcuts.html#static">Using Static Shortcuts</a> and the
- * {@link android.app.TaskStackBuilder} class reference for details.</p>
- * <p class="note"><b>Note:</b> This {@code intent} element cannot include string resources.</p>
- * <p>To learn more about how to configure intents, see
- * <a href="{@docRoot}guide/topics/ui/settings.html#Intents">Using intents</a>.</p>
- * </dd>
- *
- * <dt>{@code categories}</dt>
- * <dd><p>Provides a grouping for the types of actions that your app's shortcuts perform, such as
- * creating new chat messages.</p>
- * <p>For a list of supported shortcut categories, see the {@link ShortcutInfo} class reference
- * for a list of supported shortcut categories.
- * </dd>
- * </dl>
- *
- * <h3>Updating shortcuts</h3>
- *
- * <p>Each app's launcher icon can contain at most {@link #getMaxShortcutCountPerActivity()} number
- * of static and dynamic shortcuts combined. There is no limit to the number of pinned shortcuts
- * that an app can create, though.
- *
- * <p>When a dynamic shortcut is pinned, even when the publisher removes it as a dynamic shortcut,
- * the pinned shortcut is still visible and launchable. This allows an app to have more than
- * {@link #getMaxShortcutCountPerActivity()} number of shortcuts.
- *
- * <p>As an example, suppose {@link #getMaxShortcutCountPerActivity()} is 5:
- * <ol>
- * <li>A chat app publishes 5 dynamic shortcuts for the 5 most recent
- * conversations (c1, c2, ..., c5).
- *
- * <li>The user pins all 5 of the shortcuts.
- *
- * <li>Later, the user has started 3 additional conversations (c6, c7, and c8), so the publisher
- * app re-publishes its dynamic shortcuts. The new dynamic shortcut list is: c4, c5, ..., c8.
- * <p>The publisher app has to remove c1, c2, and c3 because it can't have more than 5 dynamic
- * shortcuts. However, c1, c2, and c3 are still pinned shortcuts that the user can access and
- * launch.
- * <p>At this point, the user can access a total of 8 shortcuts that link to activities in the
- * publisher app, including the 3 pinned shortcuts, even though an app can have at most 5
- * dynamic shortcuts.
- *
- * <li>The app can use {@link #updateShortcuts(List)} to update <em>any</em> of the existing
- * 8 shortcuts, when, for example, the chat peers' icons have changed.
- * <p>The {@link #addDynamicShortcuts(List)} and {@link #setDynamicShortcuts(List)} methods
- * can also be used to update existing shortcuts with the same IDs, but they <b>cannot</b> be
- * used for updating non-dynamic, pinned shortcuts because these 2 methods try to convert the
- * given lists of shortcuts to dynamic shortcuts.
- * </ol>
- *
- * <h3>Shortcut intents</h3>
- *
- * <p>
- * Dynamic shortcuts can be published with any set of {@link Intent#addFlags Intent} flags.
- * Typically, {@link Intent#FLAG_ACTIVITY_CLEAR_TASK} is specified, possibly along with other
- * flags; otherwise, if the app is already running, the app is simply brought to
- * the foreground, and the target activity might not appear.
- *
- * <p>Static shortcuts <b>cannot</b> have custom intent flags.
- * The first intent of a static shortcut will always have {@link Intent#FLAG_ACTIVITY_NEW_TASK}
- * and {@link Intent#FLAG_ACTIVITY_CLEAR_TASK} set. This means, when the app is already running, all
- * the existing activities in your app are destroyed when a static shortcut is launched.
- * If this behavior is not desirable, you can use a <em>trampoline activity</em>, or an invisible
- * activity that starts another activity in {@link Activity#onCreate}, then calls
- * {@link Activity#finish()}:
- * <ol>
- * <li>In the <code>AndroidManifest.xml</code> file, the trampoline activity should include the
- * attribute assignment {@code android:taskAffinity=""}.
- * <li>In the shortcuts resource file, the intent within the static shortcut should reference
- * the trampoline activity.
- * </ol>
- *
- * <h3>Rate limiting</h3>
- *
- * <p>When <a href="/guide/topics/ui/shortcuts.html#rate-limit">rate limiting</a> is active,
- * {@link #isRateLimitingActive()} returns {@code true}.
- *
- * <p>Rate limiting is reset upon certain events, so even background apps can call these APIs until
- * the rate limit is reached again. These events include the following:
- * <ul>
- * <li>An app comes to the foreground.
- * <li>The system locale changes.
- * <li>The user performs the <a href="/guide/topics/ui/notifiers/notifications.html#direct">inline
- * reply</a> action on a notification.
- * </ul>
- *
- * <h3>Handling system locale changes</h3>
- *
- * <p>Apps should update dynamic and pinned shortcuts when they receive the
- * {@link Intent#ACTION_LOCALE_CHANGED} broadcast, indicating that the system locale has changed.
- * <p>When the system locale changes, <a href="/guide/topics/ui/shortcuts.html#rate-limit">rate
- * limiting</a> is reset, so even background apps can add and update dynamic shortcuts until the
- * rate limit is reached again.
+ * <p>For guidance about using shortcuts, see
+ * <a href="/guide/topics/ui/shortcuts/index.html">App shortcuts</a>.
*
* <h3>Retrieving class instances</h3>
* <!-- Provides a heading for the content filled in by the @SystemService annotation below -->
@@ -458,8 +224,9 @@
}
/**
- * Disable pinned shortcuts. For more details, see the Javadoc for the {@link ShortcutManager}
- * class.
+ * Disable pinned shortcuts. For more details, read
+ * <a href="/guide/topics/ui/shortcuts/managing-shortcuts.html#disable-shortcuts">
+ * Disable shortcuts</a>.
*
* @throws IllegalArgumentException If trying to disable immutable shortcuts.
*
@@ -498,7 +265,9 @@
/**
* Disable pinned shortcuts, showing the user a custom error message when they try to select
* the disabled shortcuts.
- * For more details, see the Javadoc for the {@link ShortcutManager} class.
+ * For more details, read
+ * <a href="/guide/topics/ui/shortcuts/managing-shortcuts.html#disable-shortcuts">
+ * Disable shortcuts</a>.
*
* @throws IllegalArgumentException If trying to disable immutable shortcuts.
*
@@ -586,7 +355,8 @@
/**
* Return {@code true} when rate-limiting is active for the caller app.
*
- * <p>See the class level javadoc for details.
+ * <p>For details, see <a href="/guide/topics/ui/shortcuts/managing-shortcuts#rate-limiting">
+ * Rate limiting</a>.
*
* @throws IllegalStateException when the user is locked.
*/
@@ -632,7 +402,9 @@
* Apps that publish shortcuts should call this method whenever the user
* selects the shortcut containing the given ID or when the user completes
* an action in the app that is equivalent to selecting the shortcut.
- * For more details, see the Javadoc for the {@link ShortcutManager} class
+ * For more details, read about
+ * <a href="/guide/topics/ui/shortcuts/managing-shortcuts.html#track-usage">
+ * tracking shortcut usage</a>.
*
* <p>The information is accessible via {@link UsageStatsManager#queryEvents}
* Typically, launcher apps use this information to build a prediction model
@@ -700,7 +472,9 @@
* @param resultIntent If not null, this intent will be sent when the shortcut is pinned.
* Use {@link android.app.PendingIntent#getIntentSender()} to create an {@link IntentSender}.
* To avoid background execution limits, use an unexported, manifest-declared receiver.
- * For more details, see the overview documentation for the {@link ShortcutManager} class.
+ * For more details, see
+ * <a href="/guide/topics/ui/shortcuts/creating-shortcuts.html#pinned">
+ * Creating pinned shortcuts</a>.
*
* @return {@code TRUE} if the launcher supports this feature. Note the API will return without
* waiting for the user to respond, so getting {@code TRUE} from this API does *not* mean
diff --git a/core/java/android/hardware/camera2/CameraMetadata.java b/core/java/android/hardware/camera2/CameraMetadata.java
index 1275a85..caa99d5 100644
--- a/core/java/android/hardware/camera2/CameraMetadata.java
+++ b/core/java/android/hardware/camera2/CameraMetadata.java
@@ -819,11 +819,11 @@
* camera in the list of supported camera devices.</p>
* <p>This capability requires the camera device to support the following:</p>
* <ul>
- * <li>This camera device must list the following static metadata entries in {@link android.hardware.camera2.CameraCharacteristics }:<ul>
- * <li>android.logicalMultiCamera.physicalIds</li>
- * <li>{@link CameraCharacteristics#LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE android.logicalMultiCamera.sensorSyncType}</li>
- * </ul>
- * </li>
+ * <li>The IDs of underlying physical cameras are returned via
+ * {@link android.hardware.camera2.CameraCharacteristics#getPhysicalCameraIds }.</li>
+ * <li>This camera device must list static metadata
+ * {@link CameraCharacteristics#LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE android.logicalMultiCamera.sensorSyncType} in
+ * {@link android.hardware.camera2.CameraCharacteristics }.</li>
* <li>The underlying physical cameras' static metadata must list the following entries,
* so that the application can correlate pixels from the physical streams:<ul>
* <li>{@link CameraCharacteristics#LENS_POSE_REFERENCE android.lens.poseReference}</li>
diff --git a/core/java/android/service/autofill/Dataset.java b/core/java/android/service/autofill/Dataset.java
index 5211767..f8408be 100644
--- a/core/java/android/service/autofill/Dataset.java
+++ b/core/java/android/service/autofill/Dataset.java
@@ -33,8 +33,13 @@
import java.util.regex.Pattern;
/**
- * A dataset object represents a group of fields (key / value pairs) used to autofill parts of a
- * screen.
+ * <p>A <code>Dataset</code> object represents a group of fields (key / value pairs) used
+ * to autofill parts of a screen.
+ *
+ * <p>For more information about the role of datasets in the autofill workflow, read
+ * <a href="/guide/topics/text/autofill-services">Build autofill services</a> and the
+ * <code><a href="/reference/android/service/autofill/AutofillService">AutofillService</a></code>
+ * documentation.
*
* <a name="BasicUsage"></a>
* <h3>Basic usage</h3>
@@ -88,10 +93,6 @@
* <li>All other datasets are hidden.
* </ol>
*
- * <a name="MoreInfo"></a>
- * <h3>More information</h3>
- * <p>See {@link android.service.autofill.AutofillService} for more information and examples about
- * the role of datasets in the autofill workflow.
*/
public final class Dataset implements Parcelable {
diff --git a/core/java/android/service/autofill/FillCallback.java b/core/java/android/service/autofill/FillCallback.java
index 0257891..1695c13 100644
--- a/core/java/android/service/autofill/FillCallback.java
+++ b/core/java/android/service/autofill/FillCallback.java
@@ -21,8 +21,11 @@
import android.os.RemoteException;
/**
- * Handles autofill requests from the {@link AutofillService} into the {@link Activity} being
- * autofilled.
+ * <p><code>FillCallback</code> handles autofill requests from the {@link AutofillService} into
+ * the {@link Activity} being autofilled.
+ *
+ * <p>To learn about using Autofill services in your app, read
+ * <a href="/guide/topics/text/autofill-services">Build autofill services</a>.
*/
public final class FillCallback {
private final IFillCallback mCallback;
diff --git a/core/java/android/text/Layout.java b/core/java/android/text/Layout.java
index 09af85d..c6f73cb 100644
--- a/core/java/android/text/Layout.java
+++ b/core/java/android/text/Layout.java
@@ -1583,7 +1583,8 @@
}
float get(final int offset) {
- if (mHorizontals == null) {
+ if (mHorizontals == null || offset < mLineStartOffset
+ || offset >= mLineStartOffset + mHorizontals.length) {
return getHorizontal(offset, mPrimary);
} else {
return mHorizontals[offset - mLineStartOffset];
diff --git a/core/java/android/view/ViewStructure.java b/core/java/android/view/ViewStructure.java
index 3f7ab2a..38dcdd3 100644
--- a/core/java/android/view/ViewStructure.java
+++ b/core/java/android/view/ViewStructure.java
@@ -33,9 +33,14 @@
import java.util.List;
/**
- * Container for storing additional per-view data generated by {@link View#onProvideStructure
+ * <p><code>ViewStructure</code> is a container for storing additional
+ * per-view data generated by {@link View#onProvideStructure
* View.onProvideStructure} and {@link View#onProvideAutofillStructure
* View.onProvideAutofillStructure}.
+ *
+ * <p>To learn more about using Autofill in your app, read the
+ * <a href="/guide/topics/text/autofill">Autofill Framework</a> guides.
+ *
*/
public abstract class ViewStructure {
diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java
index 7555fff..27ed35c 100644
--- a/core/java/android/view/autofill/AutofillManager.java
+++ b/core/java/android/view/autofill/AutofillManager.java
@@ -77,11 +77,16 @@
import sun.misc.Cleaner;
/**
- * The {@link AutofillManager} provides ways for apps and custom views to integrate with the
- * Autofill Framework lifecycle.
+ * <p>The {@link AutofillManager} class provides ways for apps and custom views to
+ * integrate with the Autofill Framework lifecycle.
+ *
+ * <p>To learn about using Autofill in your app, read
+ * the <a href="/guide/topics/text/autofill">Autofill Framework</a> guides.
+ *
+ * <h3 id="autofill-lifecycle">Autofill lifecycle</h3>
*
* <p>The autofill lifecycle starts with the creation of an autofill context associated with an
- * activity context; the autofill context is created when one of the following methods is called for
+ * activity context. The autofill context is created when one of the following methods is called for
* the first time in an activity context, and the current user has an enabled autofill service:
*
* <ul>
@@ -90,7 +95,7 @@
* <li>{@link #requestAutofill(View)}
* </ul>
*
- * <p>Tipically, the context is automatically created when the first view of the activity is
+ * <p>Typically, the context is automatically created when the first view of the activity is
* focused because {@code View.onFocusChanged()} indirectly calls
* {@link #notifyViewEntered(View)}. App developers can call {@link #requestAutofill(View)} to
* explicitly create it (for example, a custom view developer could offer a contextual menu action
@@ -134,7 +139,9 @@
* shows an autofill save UI if the value of savable views have changed. If the user selects the
* option to Save, the current value of the views is then sent to the autofill service.
*
- * <p>It is safe to call into its methods from any thread.
+ * <h3 id="additional-notes">Additional notes</h3>
+ *
+ * <p>It is safe to call <code>AutofillManager</code> methods from any thread.
*/
@SystemService(Context.AUTOFILL_MANAGER_SERVICE)
@RequiresFeature(PackageManager.FEATURE_AUTOFILL)
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 3452b0c..9371342 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -41,7 +41,6 @@
import android.os.RemoteException;
import android.os.StrictMode;
import android.print.PrintDocumentAdapter;
-import android.security.KeyChain;
import android.util.AttributeSet;
import android.util.Log;
import android.util.SparseArray;
@@ -1419,9 +1418,8 @@
/**
* Clears the client certificate preferences stored in response
* to proceeding/cancelling client cert requests. Note that WebView
- * automatically clears these preferences when it receives a
- * {@link KeyChain#ACTION_STORAGE_CHANGED} intent. The preferences are
- * shared by all the WebViews that are created by the embedder application.
+ * automatically clears these preferences when the system keychain is updated.
+ * The preferences are shared by all the WebViews that are created by the embedder application.
*
* @param onCleared A runnable to be invoked when client certs are cleared.
* The runnable will be called in UI thread.
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 298c61e..6238e16 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -781,7 +781,7 @@
* @param firstVisibleItem the index of the first visible cell (ignore if
* visibleItemCount == 0)
* @param visibleItemCount the number of visible cells
- * @param totalItemCount the number of items in the list adaptor
+ * @param totalItemCount the number of items in the list adapter
*/
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
int totalItemCount);
diff --git a/core/java/com/android/internal/widget/MessagingLinearLayout.java b/core/java/com/android/internal/widget/MessagingLinearLayout.java
index 64b1f24..0c8613b 100644
--- a/core/java/com/android/internal/widget/MessagingLinearLayout.java
+++ b/core/java/com/android/internal/widget/MessagingLinearLayout.java
@@ -111,14 +111,16 @@
final int childHeight = child.getMeasuredHeight();
int newHeight = Math.max(totalHeight, totalHeight + childHeight + lp.topMargin +
lp.bottomMargin + spacing);
- first = false;
int measureType = MessagingChild.MEASURED_NORMAL;
if (messagingChild != null) {
measureType = messagingChild.getMeasuredType();
linesRemaining -= messagingChild.getConsumedLines();
}
- boolean isShortened = measureType == MessagingChild.MEASURED_SHORTENED;
- boolean isTooSmall = measureType == MessagingChild.MEASURED_TOO_SMALL;
+
+ // We never measure the first item as too small, we want to at least show something.
+ boolean isTooSmall = measureType == MessagingChild.MEASURED_TOO_SMALL && !first;
+ boolean isShortened = measureType == MessagingChild.MEASURED_SHORTENED
+ || measureType == MessagingChild.MEASURED_TOO_SMALL && first;
if (newHeight <= targetHeight && !isTooSmall) {
totalHeight = newHeight;
measuredWidth = Math.max(measuredWidth,
@@ -131,6 +133,7 @@
} else {
break;
}
+ first = false;
}
setMeasuredDimension(
diff --git a/core/res/res/values-mcc214-mnc01/config.xml b/core/res/res/values-mcc214-mnc01/config.xml
index 24150a7..41e24d7 100644
--- a/core/res/res/values-mcc214-mnc01/config.xml
+++ b/core/res/res/values-mcc214-mnc01/config.xml
@@ -40,4 +40,7 @@
<item>INTERNET,airtelnet.es,,,vodafone,vodafone,,,,,214,01,1,DUN</item>
</string-array>
+ <!-- Whether safe headphone volume warning dialog is disabled on Vol+ (operator specific). -->
+ <bool name="config_safe_media_disable_on_volume_up">false</bool>
+
</resources>
diff --git a/core/res/res/values-mcc222-mnc10/config.xml b/core/res/res/values-mcc222-mnc10/config.xml
index c819de2..0085a1b 100644
--- a/core/res/res/values-mcc222-mnc10/config.xml
+++ b/core/res/res/values-mcc222-mnc10/config.xml
@@ -28,4 +28,8 @@
<string-array translatable="false" name="config_tether_apndata">
<item>Tethering Internet,web.omnitel.it,,,,,,,,,222,10,,DUN</item>
</string-array>
+
+ <!-- Whether safe headphone volume warning dialog is disabled on Vol+ (operator specific). -->
+ <bool name="config_safe_media_disable_on_volume_up">false</bool>
+
</resources>
diff --git a/core/res/res/values-mcc234-mnc15/config.xml b/core/res/res/values-mcc234-mnc15/config.xml
new file mode 100644
index 0000000..84e779d
--- /dev/null
+++ b/core/res/res/values-mcc234-mnc15/config.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2018, 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.
+*/
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- Whether safe headphone volume warning dialog is disabled on Vol+ (operator specific). -->
+ <bool name="config_safe_media_disable_on_volume_up">false</bool>
+
+</resources>
diff --git a/core/res/res/values-mcc234-mnc91/config.xml b/core/res/res/values-mcc234-mnc91/config.xml
new file mode 100644
index 0000000..84e779d
--- /dev/null
+++ b/core/res/res/values-mcc234-mnc91/config.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2018, 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.
+*/
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- Whether safe headphone volume warning dialog is disabled on Vol+ (operator specific). -->
+ <bool name="config_safe_media_disable_on_volume_up">false</bool>
+
+</resources>
diff --git a/core/res/res/values-mcc262-mnc02/config.xml b/core/res/res/values-mcc262-mnc02/config.xml
new file mode 100644
index 0000000..84e779d
--- /dev/null
+++ b/core/res/res/values-mcc262-mnc02/config.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2018, 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.
+*/
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- Whether safe headphone volume warning dialog is disabled on Vol+ (operator specific). -->
+ <bool name="config_safe_media_disable_on_volume_up">false</bool>
+
+</resources>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 8f56ef9..fb7cd3d 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -2361,6 +2361,9 @@
<!-- Whether safe headphone volume is enabled or not (country specific). -->
<bool name="config_safe_media_volume_enabled">true</bool>
+ <!-- Whether safe headphone volume warning dialog is disabled on Vol+ (operator specific). -->
+ <bool name="config_safe_media_disable_on_volume_up">true</bool>
+
<!-- Set to true if the wifi display supports compositing content stored
in gralloc protected buffers. For this to be true, there must exist
a protected hardware path for surface flinger to composite and send
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 00bd77d..cf624ac 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -309,6 +309,7 @@
<java-symbol type="bool" name="config_allowAnimationsInLowPowerMode" />
<java-symbol type="bool" name="config_useDevInputEventForAudioJack" />
<java-symbol type="bool" name="config_safe_media_volume_enabled" />
+ <java-symbol type="bool" name="config_safe_media_disable_on_volume_up" />
<java-symbol type="bool" name="config_camera_sound_forced" />
<java-symbol type="bool" name="config_dontPreferApn" />
<java-symbol type="bool" name="config_restartRadioAfterProvisioning" />
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 4833816..090f9af 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -306,6 +306,7 @@
<item name="quickContactBadgeStyleSmallWindowLarge">@style/Widget.QuickContactBadgeSmall.WindowLarge</item>
<item name="listPopupWindowStyle">@style/Widget.ListPopupWindow</item>
<item name="popupMenuStyle">@style/Widget.PopupMenu</item>
+ <item name="popupTheme">@null</item>
<item name="activityChooserViewStyle">@style/Widget.ActivityChooserView</item>
<item name="fragmentBreadCrumbsStyle">@style/Widget.FragmentBreadCrumbs</item>
<item name="contextPopupMenuStyle">?attr/popupMenuStyle</item>
diff --git a/core/res/res/values/themes_holo.xml b/core/res/res/values/themes_holo.xml
index cb5b93d..33832d4 100644
--- a/core/res/res/values/themes_holo.xml
+++ b/core/res/res/values/themes_holo.xml
@@ -296,6 +296,7 @@
<item name="quickContactBadgeStyleSmallWindowLarge">@style/Widget.Holo.QuickContactBadgeSmall.WindowLarge</item>
<item name="listPopupWindowStyle">@style/Widget.Holo.ListPopupWindow</item>
<item name="popupMenuStyle">@style/Widget.Holo.PopupMenu</item>
+ <item name="popupTheme">@null</item>
<item name="stackViewStyle">@style/Widget.Holo.StackView</item>
<item name="activityChooserViewStyle">@style/Widget.Holo.ActivityChooserView</item>
<item name="fragmentBreadCrumbsStyle">@style/Widget.Holo.FragmentBreadCrumbs</item>
@@ -658,9 +659,11 @@
<item name="quickContactBadgeStyleSmallWindowLarge">@style/Widget.Holo.QuickContactBadgeSmall.WindowLarge</item>
<item name="listPopupWindowStyle">@style/Widget.Holo.Light.ListPopupWindow</item>
<item name="popupMenuStyle">@style/Widget.Holo.Light.PopupMenu</item>
+ <item name="popupTheme">@null</item>
<item name="stackViewStyle">@style/Widget.Holo.StackView</item>
<item name="activityChooserViewStyle">@style/Widget.Holo.Light.ActivityChooserView</item>
<item name="fragmentBreadCrumbsStyle">@style/Widget.Holo.Light.FragmentBreadCrumbs</item>
+ <item name="contextPopupMenuStyle">?attr/popupMenuStyle</item>
<!-- Preference styles -->
<item name="preferenceScreenStyle">@style/Preference.Holo.PreferenceScreen</item>
diff --git a/keystore/java/android/security/keystore/AndroidKeyStoreKeyGeneratorSpi.java b/keystore/java/android/security/keystore/AndroidKeyStoreKeyGeneratorSpi.java
index 419eb24..953cef7d 100644
--- a/keystore/java/android/security/keystore/AndroidKeyStoreKeyGeneratorSpi.java
+++ b/keystore/java/android/security/keystore/AndroidKeyStoreKeyGeneratorSpi.java
@@ -301,6 +301,9 @@
KeyStoreCryptoOperationUtils.getRandomBytesToMixIntoKeystoreRng(
mRng, (mKeySizeBits + 7) / 8);
int flags = 0;
+ if (spec.isStrongBoxBacked()) {
+ flags |= KeyStore.FLAG_STRONGBOX;
+ }
String keyAliasInKeystore = Credentials.USER_PRIVATE_KEY + spec.getKeystoreAlias();
KeyCharacteristics resultingKeyCharacteristics = new KeyCharacteristics();
boolean success = false;
@@ -314,8 +317,12 @@
flags,
resultingKeyCharacteristics);
if (errorCode != KeyStore.NO_ERROR) {
- throw new ProviderException(
- "Keystore operation failed", KeyStore.getKeyStoreException(errorCode));
+ if (errorCode == KeyStore.HARDWARE_TYPE_UNAVAILABLE) {
+ throw new StrongBoxUnavailableException("Failed to generate key");
+ } else {
+ throw new ProviderException(
+ "Keystore operation failed", KeyStore.getKeyStoreException(errorCode));
+ }
}
@KeyProperties.KeyAlgorithmEnum String keyAlgorithmJCA;
try {
diff --git a/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java b/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
index 3643ca4..8a02a82 100644
--- a/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
+++ b/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
@@ -18,6 +18,7 @@
import android.os.SystemClock;
import android.os.connectivity.GpsBatteryStats;
+import android.os.SystemProperties;
import android.text.format.DateUtils;
import android.util.Base64;
@@ -175,6 +176,7 @@
= topFourAverageCn0Statistics.getStandardDeviation();
}
msg.powerMetrics = mGnssPowerMetrics.buildProto();
+ msg.hardwareRevision = SystemProperties.get("ro.boot.revision", "");
String s = Base64.encodeToString(GnssLog.toByteArray(msg), Base64.DEFAULT);
reset();
return s;
@@ -239,6 +241,7 @@
s.append(" Energy consumed while on battery (mAh): ").append(
stats.getEnergyConsumedMaMs() / ((double) DateUtils.HOUR_IN_MILLIS)).append("\n");
}
+ s.append("Hardware Version: " + SystemProperties.get("ro.boot.revision", "")).append("\n");
return s.toString();
}
diff --git a/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java b/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java
index 093b1bd..15cb9bd 100644
--- a/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java
+++ b/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java
@@ -25,6 +25,7 @@
import android.arch.lifecycle.Lifecycle;
import android.arch.lifecycle.LifecycleObserver;
import android.arch.lifecycle.OnLifecycleEvent;
+
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -62,6 +63,7 @@
import java.io.IOException;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import java.lang.ref.WeakReference;
import java.text.Collator;
import java.text.Normalizer;
import java.text.Normalizer.Form;
@@ -132,7 +134,7 @@
boolean mSessionsChanged;
// Temporary for dispatching session callbacks. Only touched by main thread.
- final ArrayList<Session> mActiveSessions = new ArrayList<Session>();
+ final ArrayList<WeakReference<Session>> mActiveSessions = new ArrayList<>();
final HandlerThread mThread;
final BackgroundHandler mBackgroundHandler;
@@ -618,7 +620,7 @@
for (int i=0; i<mSessions.size(); i++) {
Session s = mSessions.get(i);
if (s.mResumed) {
- mActiveSessions.add(s);
+ mActiveSessions.add(new WeakReference<>(s));
}
}
}
@@ -830,46 +832,70 @@
rebuildActiveSessions();
switch (msg.what) {
case MSG_REBUILD_COMPLETE: {
- Session s = (Session)msg.obj;
- if (mActiveSessions.contains(s)) {
- s.mCallbacks.onRebuildComplete(s.mLastAppList);
+ Session s = (Session) msg.obj;
+ for (WeakReference<Session> sessionRef : mActiveSessions) {
+ final Session session = sessionRef.get();
+ if (session != null && session == s) {
+ s.mCallbacks.onRebuildComplete(s.mLastAppList);
+ }
}
} break;
case MSG_PACKAGE_LIST_CHANGED: {
- for (int i=0; i<mActiveSessions.size(); i++) {
- mActiveSessions.get(i).mCallbacks.onPackageListChanged();
+ for (WeakReference<Session> sessionRef : mActiveSessions) {
+ final Session session = sessionRef.get();
+ if (session != null) {
+ session.mCallbacks.onPackageListChanged();
+ }
}
} break;
case MSG_PACKAGE_ICON_CHANGED: {
- for (int i=0; i<mActiveSessions.size(); i++) {
- mActiveSessions.get(i).mCallbacks.onPackageIconChanged();
+ for (WeakReference<Session> sessionRef : mActiveSessions) {
+ final Session session = sessionRef.get();
+ if (session != null) {
+ session.mCallbacks.onPackageIconChanged();
+ }
}
} break;
case MSG_PACKAGE_SIZE_CHANGED: {
- for (int i=0; i<mActiveSessions.size(); i++) {
- mActiveSessions.get(i).mCallbacks.onPackageSizeChanged(
- (String)msg.obj);
+ for (WeakReference<Session> sessionRef : mActiveSessions) {
+ final Session session = sessionRef.get();
+ if (session != null) {
+ session.mCallbacks.onPackageSizeChanged(
+ (String) msg.obj);
+ }
}
} break;
case MSG_ALL_SIZES_COMPUTED: {
- for (int i=0; i<mActiveSessions.size(); i++) {
- mActiveSessions.get(i).mCallbacks.onAllSizesComputed();
+ for (WeakReference<Session> sessionRef : mActiveSessions) {
+ final Session session = sessionRef.get();
+ if (session != null) {
+ session.mCallbacks.onAllSizesComputed();
+ }
}
} break;
case MSG_RUNNING_STATE_CHANGED: {
- for (int i=0; i<mActiveSessions.size(); i++) {
- mActiveSessions.get(i).mCallbacks.onRunningStateChanged(
- msg.arg1 != 0);
+ for (WeakReference<Session> sessionRef : mActiveSessions) {
+ final Session session = sessionRef.get();
+ if (session != null) {
+ session.mCallbacks.onRunningStateChanged(
+ msg.arg1 != 0);
+ }
}
} break;
case MSG_LAUNCHER_INFO_CHANGED: {
- for (int i=0; i<mActiveSessions.size(); i++) {
- mActiveSessions.get(i).mCallbacks.onLauncherInfoChanged();
+ for (WeakReference<Session> sessionRef : mActiveSessions) {
+ final Session session = sessionRef.get();
+ if (session != null) {
+ session.mCallbacks.onLauncherInfoChanged();
+ }
}
} break;
case MSG_LOAD_ENTRIES_COMPLETE: {
- for (int i=0; i<mActiveSessions.size(); i++) {
- mActiveSessions.get(i).mCallbacks.onLoadEntriesCompleted();
+ for (WeakReference<Session> sessionRef : mActiveSessions) {
+ final Session session = sessionRef.get();
+ if (session != null) {
+ session.mCallbacks.onLoadEntriesCompleted();
+ }
}
} break;
}
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothManager.java
index 3732471..1c50953 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothManager.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/LocalBluetoothManager.java
@@ -19,6 +19,8 @@
import android.content.Context;
import android.util.Log;
+import java.lang.ref.WeakReference;
+
/**
* LocalBluetoothManager provides a simplified interface on top of a subset of
* the Bluetooth API. Note that {@link #getInstance} will return null
@@ -34,7 +36,7 @@
private final Context mContext;
/** If a BT-related activity is in the foreground, this will be it. */
- private Context mForegroundActivity;
+ private WeakReference<Context> mForegroundActivity;
private final LocalBluetoothAdapter mLocalAdapter;
@@ -85,17 +87,19 @@
}
public Context getForegroundActivity() {
- return mForegroundActivity;
+ return mForegroundActivity == null
+ ? null
+ : mForegroundActivity.get();
}
public boolean isForegroundActivity() {
- return mForegroundActivity != null;
+ return mForegroundActivity != null && mForegroundActivity.get() != null;
}
public synchronized void setForegroundActivity(Context context) {
if (context != null) {
Log.d(TAG, "setting foreground activity to non-null context");
- mForegroundActivity = context;
+ mForegroundActivity = new WeakReference<>(context);
} else {
if (mForegroundActivity != null) {
Log.d(TAG, "setting foreground activity to null");
diff --git a/packages/SettingsLib/src/com/android/settingslib/dream/DreamBackend.java b/packages/SettingsLib/src/com/android/settingslib/dream/DreamBackend.java
index 988060e..e5d97c9 100644
--- a/packages/SettingsLib/src/com/android/settingslib/dream/DreamBackend.java
+++ b/packages/SettingsLib/src/com/android/settingslib/dream/DreamBackend.java
@@ -36,12 +36,12 @@
import android.util.Log;
import android.util.Xml;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -97,15 +97,15 @@
}
public DreamBackend(Context context) {
- mContext = context;
+ mContext = context.getApplicationContext();
mDreamManager = IDreamManager.Stub.asInterface(
ServiceManager.getService(DreamService.DREAM_SERVICE));
mComparator = new DreamInfoComparator(getDefaultDream());
- mDreamsEnabledByDefault = context.getResources()
+ mDreamsEnabledByDefault = mContext.getResources()
.getBoolean(com.android.internal.R.bool.config_dreamsEnabledByDefault);
- mDreamsActivatedOnSleepByDefault = context.getResources()
+ mDreamsActivatedOnSleepByDefault = mContext.getResources()
.getBoolean(com.android.internal.R.bool.config_dreamsActivatedOnSleepByDefault);
- mDreamsActivatedOnDockByDefault = context.getResources()
+ mDreamsActivatedOnDockByDefault = mContext.getResources()
.getBoolean(com.android.internal.R.bool.config_dreamsActivatedOnDockByDefault);
}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/SafetyWarningDialog.java b/packages/SystemUI/src/com/android/systemui/volume/SafetyWarningDialog.java
index d7c4bbf..c97095e 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/SafetyWarningDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/SafetyWarningDialog.java
@@ -21,11 +21,13 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.res.Resources.NotFoundException;
import android.media.AudioManager;
import android.util.Log;
import android.view.KeyEvent;
import android.view.WindowManager;
+
import com.android.systemui.statusbar.phone.SystemUIDialog;
abstract public class SafetyWarningDialog extends SystemUIDialog
@@ -40,12 +42,18 @@
private long mShowTime;
private boolean mNewVolumeUp;
+ private boolean mDisableOnVolumeUp;
public SafetyWarningDialog(Context context, AudioManager audioManager) {
super(context);
mContext = context;
mAudioManager = audioManager;
-
+ try {
+ mDisableOnVolumeUp = mContext.getResources().getBoolean(
+ com.android.internal.R.bool.config_safe_media_disable_on_volume_up);
+ } catch (NotFoundException e) {
+ mDisableOnVolumeUp = true;
+ }
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ERROR);
setShowForAllUsers(true);
setMessage(mContext.getString(com.android.internal.R.string.safe_media_volume_warning));
@@ -63,7 +71,8 @@
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
- if (keyCode == KeyEvent.KEYCODE_VOLUME_UP && event.getRepeatCount() == 0) {
+ if (mDisableOnVolumeUp && keyCode == KeyEvent.KEYCODE_VOLUME_UP
+ && event.getRepeatCount() == 0) {
mNewVolumeUp = true;
}
return super.onKeyDown(keyCode, event);
diff --git a/proto/src/gnss.proto b/proto/src/gnss.proto
index 0168392..1509fc0 100644
--- a/proto/src/gnss.proto
+++ b/proto/src/gnss.proto
@@ -45,6 +45,9 @@
// Power metrics
optional PowerMetrics power_metrics = 12;
+
+ // Hardware revision (EVT, DVT, PVT etc.)
+ optional string hardware_revision = 13;
}
// Power metrics
diff --git a/proto/src/wifi.proto b/proto/src/wifi.proto
index a98996d..b29c992 100644
--- a/proto/src/wifi.proto
+++ b/proto/src/wifi.proto
@@ -459,6 +459,9 @@
// Histogram of the EAP method type of all installed Passpoint profiles
repeated PasspointProfileTypeCount installed_passpoint_profile_type = 123;
+
+ // Hardware revision (EVT, DVT, PVT etc.)
+ optional string hardware_revision = 124;
}
// Information that gets logged for every WiFi connection.
diff --git a/services/core/java/com/android/server/notification/ZenModeConditions.java b/services/core/java/com/android/server/notification/ZenModeConditions.java
index 8013f7a..b080a73 100644
--- a/services/core/java/com/android/server/notification/ZenModeConditions.java
+++ b/services/core/java/com/android/server/notification/ZenModeConditions.java
@@ -19,7 +19,6 @@
import android.content.ComponentName;
import android.net.Uri;
import android.service.notification.Condition;
-import android.service.notification.IConditionListener;
import android.service.notification.IConditionProvider;
import android.service.notification.ZenModeConfig;
import android.service.notification.ZenModeConfig.ZenRule;
@@ -27,6 +26,8 @@
import android.util.ArraySet;
import android.util.Log;
+import com.android.internal.annotations.VisibleForTesting;
+
import java.io.PrintWriter;
import java.util.Objects;
@@ -36,7 +37,9 @@
private final ZenModeHelper mHelper;
private final ConditionProviders mConditionProviders;
- private final ArrayMap<Uri, ComponentName> mSubscriptions = new ArrayMap<>();
+
+ @VisibleForTesting
+ protected final ArrayMap<Uri, ComponentName> mSubscriptions = new ArrayMap<>();
private boolean mFirstEvaluation = true;
@@ -152,7 +155,8 @@
if (current != null) {
current.add(id);
}
- if (processSubscriptions && trigger != null && trigger.equals(rule.component)) {
+ if (processSubscriptions && ((trigger != null && trigger.equals(rule.component))
+ || isSystemCondition)) {
if (DEBUG) Log.d(TAG, "Subscribing to " + rule.component);
if (mConditionProviders.subscribeIfNecessary(rule.component, rule.conditionId)) {
synchronized (mSubscriptions) {
diff --git a/services/core/java/com/android/server/notification/ZenModeHelper.java b/services/core/java/com/android/server/notification/ZenModeHelper.java
index 6ab2c43..0c42f8a 100644
--- a/services/core/java/com/android/server/notification/ZenModeHelper.java
+++ b/services/core/java/com/android/server/notification/ZenModeHelper.java
@@ -102,7 +102,7 @@
private final ZenModeFiltering mFiltering;
protected final RingerModeDelegate mRingerModeDelegate = new
RingerModeDelegate();
- private final ZenModeConditions mConditions;
+ @VisibleForTesting protected final ZenModeConditions mConditions;
private final SparseArray<ZenModeConfig> mConfigs = new SparseArray<>();
private final Metrics mMetrics = new Metrics();
private final ConditionProviders.Config mServiceConfig;
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 82ad46f..670c1af 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -12344,7 +12344,8 @@
if (DEBUG_REMOVE) Log.d(TAG, " Activities: " + r);
}
- mPermissionManager.removeAllPermissions(pkg, chatty);
+ final ArrayList<String> allPackageNames = new ArrayList<>(mPackages.keySet());
+ mPermissionManager.removeAllPermissions(pkg, allPackageNames, mPermissionCallback, chatty);
N = pkg.instrumentation.size();
r = null;
diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerInternal.java b/services/core/java/com/android/server/pm/permission/PermissionManagerInternal.java
index a042fed..c3f23a8 100644
--- a/services/core/java/com/android/server/pm/permission/PermissionManagerInternal.java
+++ b/services/core/java/com/android/server/pm/permission/PermissionManagerInternal.java
@@ -115,7 +115,11 @@
*/
public abstract void addAllPermissions(@NonNull PackageParser.Package pkg, boolean chatty);
public abstract void addAllPermissionGroups(@NonNull PackageParser.Package pkg, boolean chatty);
- public abstract void removeAllPermissions(@NonNull PackageParser.Package pkg, boolean chatty);
+ public abstract void removeAllPermissions(
+ @NonNull PackageParser.Package pkg,
+ @NonNull List<String> allPackageNames,
+ @Nullable PermissionCallback permissionCallback,
+ boolean chatty);
public abstract boolean addDynamicPermission(@NonNull PermissionInfo info, boolean async,
int callingUid, @Nullable PermissionCallback callback);
public abstract void removeDynamicPermission(@NonNull String permName, int callingUid,
@@ -189,4 +193,4 @@
/** HACK HACK methods to allow for partial migration of data to the PermissionManager class */
public abstract @Nullable BasePermission getPermissionTEMP(@NonNull String permName);
-}
\ No newline at end of file
+}
diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
index c51a724..02c9049 100644
--- a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
+++ b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
@@ -30,6 +30,7 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
+import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManagerInternal;
import android.content.pm.PackageParser;
@@ -37,6 +38,7 @@
import android.content.pm.PermissionInfo;
import android.content.pm.PackageParser.Package;
import android.metrics.LogMaker;
+import android.os.AsyncTask;
import android.os.Binder;
import android.os.Build;
import android.os.Handler;
@@ -455,8 +457,9 @@
" to " + newPermissionGroupName);
try {
- revokeRuntimePermission(permissionName, packageName, false,
- Process.SYSTEM_UID, userId, permissionCallback);
+ revokeRuntimePermission(permissionName, packageName,
+ mSettings.getPermission(permissionName), false,
+ Process.SYSTEM_UID, userId, permissionCallback, false);
} catch (IllegalArgumentException e) {
Slog.e(TAG, "Could not revoke " + permissionName + " from "
+ packageName, e);
@@ -549,9 +552,59 @@
}
- private void removeAllPermissions(PackageParser.Package pkg, boolean chatty) {
+ private void revokeAllPermissions(
+ @NonNull List<BasePermission> bps,
+ @NonNull List<String> allPackageNames,
+ @Nullable PermissionCallback permissionCallback) {
+ AsyncTask.execute(() -> {
+ final int numRemovedPermissions = bps.size();
+ for (int permissionNum = 0; permissionNum < numRemovedPermissions; permissionNum++) {
+ final int[] userIds = mUserManagerInt.getUserIds();
+ final int numUserIds = userIds.length;
+
+ final int numPackages = allPackageNames.size();
+ for (int packageNum = 0; packageNum < numPackages; packageNum++) {
+ final String packageName = allPackageNames.get(packageNum);
+ final ApplicationInfo applicationInfo = mPackageManagerInt.getApplicationInfo(
+ packageName, 0, Process.SYSTEM_UID, UserHandle.USER_SYSTEM);
+ if (applicationInfo != null
+ && applicationInfo.targetSdkVersion < Build.VERSION_CODES.M) {
+ continue;
+ }
+ for (int userIdNum = 0; userIdNum < numUserIds; userIdNum++) {
+ final int userId = userIds[userIdNum];
+ final String permissionName = bps.get(permissionNum).getName();
+ if (checkPermission(permissionName, packageName, UserHandle.USER_SYSTEM,
+ userId) == PackageManager.PERMISSION_GRANTED) {
+ try {
+ revokeRuntimePermission(
+ permissionName,
+ packageName,
+ bps.get(permissionNum),
+ false,
+ Process.SYSTEM_UID,
+ userId,
+ permissionCallback,
+ true);
+ } catch (IllegalArgumentException e) {
+ Slog.e(TAG, "Could not revoke " + permissionName + " from "
+ + packageName, e);
+ }
+ }
+ }
+ }
+ }
+ });
+ }
+
+ private void removeAllPermissions(
+ @NonNull PackageParser.Package pkg,
+ @NonNull List<String> allPackageNames,
+ @Nullable PermissionCallback permissionCallback,
+ boolean chatty) {
synchronized (mLock) {
int N = pkg.permissions.size();
+ List<BasePermission> bps = new ArrayList<BasePermission>(N);
StringBuilder r = null;
for (int i=0; i<N; i++) {
PackageParser.Permission p = pkg.permissions.get(i);
@@ -560,6 +613,9 @@
bp = mSettings.mPermissionTrees.get(p.info.name);
}
if (bp != null && bp.isPermission(p)) {
+ if ((p.info.getProtection() & PermissionInfo.PROTECTION_DANGEROUS) != 0) {
+ bps.add(bp);
+ }
bp.setPermission(null);
if (DEBUG_REMOVE && chatty) {
if (r == null) {
@@ -578,6 +634,7 @@
}
}
}
+ revokeAllPermissions(bps, allPackageNames, permissionCallback);
if (r != null) {
if (DEBUG_REMOVE) Log.d(TAG, " Permissions: " + r);
}
@@ -1490,9 +1547,10 @@
}
}
-
- private void revokeRuntimePermission(String permName, String packageName,
- boolean overridePolicy, int callingUid, int userId, PermissionCallback callback) {
+
+ private void revokeRuntimePermission(String permName, String packageName, BasePermission bp,
+ boolean overridePolicy, int callingUid, int userId, PermissionCallback callback,
+ boolean permissionRemoved) {
if (!mUserManagerInt.exists(userId)) {
Log.e(TAG, "No such user:" + userId);
return;
@@ -1517,7 +1575,7 @@
if (mPackageManagerInt.filterAppAccess(pkg, Binder.getCallingUid(), userId)) {
throw new IllegalArgumentException("Unknown package: " + packageName);
}
- final BasePermission bp = mSettings.getPermissionLocked(permName);
+
if (bp == null) {
throw new IllegalArgumentException("Unknown permission: " + permName);
}
@@ -2073,8 +2131,10 @@
PermissionManagerService.this.addAllPermissionGroups(pkg, chatty);
}
@Override
- public void removeAllPermissions(Package pkg, boolean chatty) {
- PermissionManagerService.this.removeAllPermissions(pkg, chatty);
+ public void removeAllPermissions(Package pkg, List<String> allPackageNames,
+ PermissionCallback permissionCallback, boolean chatty) {
+ PermissionManagerService.this.removeAllPermissions(
+ pkg, allPackageNames, permissionCallback, chatty);
}
@Override
public boolean addDynamicPermission(PermissionInfo info, boolean async, int callingUid,
@@ -2110,7 +2170,8 @@
boolean overridePolicy, int callingUid, int userId,
PermissionCallback callback) {
PermissionManagerService.this.revokeRuntimePermission(permName, packageName,
- overridePolicy, callingUid, userId, callback);
+ mSettings.getPermission(permName), overridePolicy, callingUid, userId,
+ callback, false);
}
@Override
public void updatePermissions(String packageName, Package pkg, boolean replaceGrant,
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/ZenModeHelperTest.java b/services/tests/uiservicestests/src/com/android/server/notification/ZenModeHelperTest.java
index 63a60a4..8222c38 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/ZenModeHelperTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/ZenModeHelperTest.java
@@ -38,6 +38,7 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import android.app.AppGlobals;
import android.app.AppOpsManager;
import android.app.NotificationManager;
import android.content.ComponentName;
@@ -49,8 +50,10 @@
import android.media.AudioManagerInternal;
import android.media.VolumePolicy;
import android.media.AudioSystem;
+import android.net.Uri;
import android.provider.Settings;
import android.provider.Settings.Global;
+import android.service.notification.Condition;
import android.service.notification.ZenModeConfig;
import android.service.notification.ZenModeConfig.ScheduleInfo;
import android.test.suitebuilder.annotation.SmallTest;
@@ -61,6 +64,7 @@
import com.android.internal.R;
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
+import com.android.server.notification.ManagedServices.UserProfiles;
import com.android.internal.util.FastXmlSerializer;
import com.android.server.UiServiceTestCase;
import android.util.Slog;
@@ -83,7 +87,7 @@
@TestableLooper.RunWithLooper
public class ZenModeHelperTest extends UiServiceTestCase {
- @Mock ConditionProviders mConditionProviders;
+ ConditionProviders mConditionProviders;
@Mock NotificationManager mNotificationManager;
@Mock private Resources mResources;
private TestableLooper mTestableLooper;
@@ -103,6 +107,9 @@
when(mResources.getString(R.string.zen_mode_default_events_name)).thenReturn("events");
when(mContext.getSystemService(NotificationManager.class)).thenReturn(mNotificationManager);
+ mConditionProviders = new ConditionProviders(mContext, new UserProfiles(),
+ AppGlobals.getPackageManager());
+ mConditionProviders.addSystemProvider(new CountdownConditionProvider());
mZenModeHelperSpy = spy(new ZenModeHelper(mContext, mTestableLooper.getLooper(),
mConditionProviders));
}
@@ -813,6 +820,30 @@
setupZenConfigMaintained();
}
+ @Test
+ public void testCountdownConditionSubscription() throws Exception {
+ ZenModeConfig config = new ZenModeConfig();
+ mZenModeHelperSpy.mConfig = config;
+ mZenModeHelperSpy.mConditions.evaluateConfig(mZenModeHelperSpy.mConfig, null, true);
+ assertEquals(0, mZenModeHelperSpy.mConditions.mSubscriptions.size());
+
+ mZenModeHelperSpy.mConfig.manualRule = new ZenModeConfig.ZenRule();
+ Uri conditionId = ZenModeConfig.toCountdownConditionId(9000000, false);
+ mZenModeHelperSpy.mConfig.manualRule.conditionId = conditionId;
+ mZenModeHelperSpy.mConfig.manualRule.component = new ComponentName("android",
+ CountdownConditionProvider.class.getName());
+ mZenModeHelperSpy.mConfig.manualRule.condition = new Condition(conditionId, "", "", "", 0,
+ Condition.STATE_TRUE, Condition.FLAG_RELEVANT_NOW);
+ mZenModeHelperSpy.mConfig.manualRule.enabled = true;
+ ZenModeConfig originalConfig = mZenModeHelperSpy.mConfig.copy();
+
+ mZenModeHelperSpy.mConditions.evaluateConfig(mZenModeHelperSpy.mConfig, null, true);
+
+ assertEquals(true, ZenModeConfig.isValidCountdownConditionId(conditionId));
+ assertEquals(originalConfig, mZenModeHelperSpy.mConfig);
+ assertEquals(1, mZenModeHelperSpy.mConditions.mSubscriptions.size());
+ }
+
private void setupZenConfig() {
mZenModeHelperSpy.mZenMode = Settings.Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS;
mZenModeHelperSpy.mConfig.allowAlarms = false;
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index e0696b3..a8b39e3 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -1489,6 +1489,15 @@
"always_play_remote_hold_tone_bool";
/**
+ * When true, the Telephony stack will automatically turn off airplane mode and retry a wifi
+ * emergency call over the cell network if the initial attempt at dialing was met with a SIP 308
+ * error.
+ * @hide
+ */
+ public static final String KEY_AUTO_RETRY_FAILED_WIFI_EMERGENCY_CALL =
+ "auto_retry_failed_wifi_emergency_call";
+
+ /**
* When true, indicates that adding a call is disabled when there is an ongoing video call
* or when there is an ongoing call on wifi which was downgraded from video and VoWifi is
* turned off.
@@ -2016,6 +2025,7 @@
sDefaults.putBoolean(KEY_ALLOW_HOLD_IN_IMS_CALL_BOOL, true);
sDefaults.putBoolean(KEY_CARRIER_ALLOW_DEFLECT_IMS_CALL_BOOL, false);
sDefaults.putBoolean(KEY_ALWAYS_PLAY_REMOTE_HOLD_TONE_BOOL, false);
+ sDefaults.putBoolean(KEY_AUTO_RETRY_FAILED_WIFI_EMERGENCY_CALL, false);
sDefaults.putBoolean(KEY_ADDITIONAL_CALL_SETTING_BOOL, true);
sDefaults.putBoolean(KEY_ALLOW_EMERGENCY_NUMBERS_IN_CALL_LOG_BOOL, false);
sDefaults.putStringArray(KEY_UNLOGGABLE_NUMBERS_STRING_ARRAY, null);