diff options
48 files changed, 344 insertions, 295 deletions
diff --git a/api/Android.bp b/api/Android.bp new file mode 100644 index 000000000000..54ff82c97e17 --- /dev/null +++ b/api/Android.bp @@ -0,0 +1,7 @@ +genrule { + name: "current-api-xml", + tools: ["metalava"], + srcs: ["current.txt"], + out: ["current.api"], + cmd: "$(location metalava) --no-banner -convert2xmlnostrip $(in) $(out)", +} diff --git a/api/test-current.txt b/api/test-current.txt index 077abe0b3537..7f57e301cc82 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -54,6 +54,7 @@ package android.app { method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public int getPackageImportance(String); method public long getTotalRam(); method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public int getUidImportance(int); + method public static boolean isHighEndGfx(); method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public void removeOnUidImportanceListener(android.app.ActivityManager.OnUidImportanceListener); method public static void resumeAppSwitches() throws android.os.RemoteException; method @RequiresPermission(android.Manifest.permission.CHANGE_CONFIGURATION) public void scheduleApplicationInfoChanged(java.util.List<java.lang.String>, int); diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java index cebe6e1211e0..90b80e73c323 100644 --- a/core/java/android/accessibilityservice/AccessibilityService.java +++ b/core/java/android/accessibilityservice/AccessibilityService.java @@ -309,7 +309,7 @@ public abstract class AccessibilityService extends Service { * Name under which an AccessibilityService component publishes information * about itself. This meta-data must reference an XML resource containing an * <code><{@link android.R.styleable#AccessibilityService accessibility-service}></code> - * tag. This is a a sample XML file configuring an accessibility service: + * tag. This is a sample XML file configuring an accessibility service: * <pre> <accessibility-service * android:accessibilityEventTypes="typeViewClicked|typeViewFocused" * android:packageNames="foo.bar, foo.baz" diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index dc52c52cca1f..f5b0b592e6a7 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -1547,7 +1547,9 @@ public class Activity extends ContextThemeWrapper * had previously been frozen by {@link #onSaveInstanceState}. * * <p>This method is called between {@link #onStart} and - * {@link #onPostCreate}. + * {@link #onPostCreate}. This method is called only when recreating + * an activity; the method isn't invoked if {@link #onStart} is called for + * any other reason.</p> * * @param savedInstanceState the data most recently supplied in {@link #onSaveInstanceState}. * diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index 17368b789645..91b98c71a613 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -925,7 +925,7 @@ public class ActivityManager { * (which tends to consume a lot more RAM). * @hide */ - @UnsupportedAppUsage + @TestApi static public boolean isHighEndGfx() { return !isLowRamDeviceStatic() && !RoSystemProperties.CONFIG_AVOID_GFX_ACCEL diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index d780b09bc7f1..1b515737c479 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -1005,8 +1005,7 @@ public final class ActivityThread extends ClientTransactionHandler { boolean isRestrictedBackupMode, boolean persistent, Configuration config, CompatibilityInfo compatInfo, Map services, Bundle coreSettings, String buildSerial, AutofillOptions autofillOptions, - ContentCaptureOptions contentCaptureOptions, - long[] disabledCompatChanges) { + ContentCaptureOptions contentCaptureOptions, long[] disabledCompatChanges) { if (services != null) { if (false) { // Test code to make sure the app could see the passed-in services. @@ -1052,6 +1051,8 @@ public final class ActivityThread extends ClientTransactionHandler { data.compatInfo = compatInfo; data.initProfilerInfo = profilerInfo; data.buildSerial = buildSerial; + data.autofillOptions = autofillOptions; + data.contentCaptureOptions = contentCaptureOptions; data.disabledCompatChanges = disabledCompatChanges; sendMessage(H.BIND_APPLICATION, data); } @@ -6133,7 +6134,6 @@ public final class ActivityThread extends ClientTransactionHandler { if (data.trackAllocation) { DdmVmInternal.enableRecentAllocations(true); } - // Note when this process has started. Process.setStartTimes(SystemClock.elapsedRealtime(), SystemClock.uptimeMillis()); diff --git a/core/java/android/app/AppOpsManager.java b/core/java/android/app/AppOpsManager.java index da4c0386a76f..8cae56d1acf4 100644 --- a/core/java/android/app/AppOpsManager.java +++ b/core/java/android/app/AppOpsManager.java @@ -240,7 +240,8 @@ public class AppOpsManager { public @interface UidState {} /** - * Uid state: The UID is a foreground persistent app. + * Uid state: The UID is a foreground persistent app. The lower the UID + * state the more important the UID is for the user. * @hide */ @TestApi @@ -248,7 +249,8 @@ public class AppOpsManager { public static final int UID_STATE_PERSISTENT = 100; /** - * Uid state: The UID is top foreground app. + * Uid state: The UID is top foreground app. The lower the UID + * state the more important the UID is for the user. * @hide */ @TestApi @@ -257,6 +259,7 @@ public class AppOpsManager { /** * Uid state: The UID is running a foreground service of location type. + * The lower the UID state the more important the UID is for the user. * @hide */ @TestApi @@ -264,7 +267,8 @@ public class AppOpsManager { public static final int UID_STATE_FOREGROUND_SERVICE_LOCATION = 300; /** - * Uid state: The UID is running a foreground service. + * Uid state: The UID is running a foreground service. The lower the UID + * state the more important the UID is for the user. * @hide */ @TestApi @@ -279,7 +283,8 @@ public class AppOpsManager { public static final int UID_STATE_MAX_LAST_NON_RESTRICTED = UID_STATE_FOREGROUND_SERVICE; /** - * Uid state: The UID is a foreground app. + * Uid state: The UID is a foreground app. The lower the UID + * state the more important the UID is for the user. * @hide */ @TestApi @@ -287,7 +292,8 @@ public class AppOpsManager { public static final int UID_STATE_FOREGROUND = 500; /** - * Uid state: The UID is a background app. + * Uid state: The UID is a background app. The lower the UID + * state the more important the UID is for the user. * @hide */ @TestApi @@ -295,7 +301,8 @@ public class AppOpsManager { public static final int UID_STATE_BACKGROUND = 600; /** - * Uid state: The UID is a cached app. + * Uid state: The UID is a cached app. The lower the UID + * state the more important the UID is for the user. * @hide */ @TestApi diff --git a/core/java/android/app/slice/SliceProvider.java b/core/java/android/app/slice/SliceProvider.java index 0ccd49f2e028..5e530eedd818 100644 --- a/core/java/android/app/slice/SliceProvider.java +++ b/core/java/android/app/slice/SliceProvider.java @@ -355,7 +355,8 @@ public abstract class SliceProvider extends ContentProvider { @Override public Bundle call(String method, String arg, Bundle extras) { if (method.equals(METHOD_SLICE)) { - Uri uri = getUriWithoutUserId(extras.getParcelable(EXTRA_BIND_URI)); + Uri uri = getUriWithoutUserId(validateIncomingUriOrNull( + extras.getParcelable(EXTRA_BIND_URI))); List<SliceSpec> supportedSpecs = extras.getParcelableArrayList(EXTRA_SUPPORTED_SPECS); String callingPackage = getCallingPackage(); @@ -369,7 +370,7 @@ public abstract class SliceProvider extends ContentProvider { } else if (method.equals(METHOD_MAP_INTENT)) { Intent intent = extras.getParcelable(EXTRA_INTENT); if (intent == null) return null; - Uri uri = onMapIntentToUri(intent); + Uri uri = validateIncomingUriOrNull(onMapIntentToUri(intent)); List<SliceSpec> supportedSpecs = extras.getParcelableArrayList(EXTRA_SUPPORTED_SPECS); Bundle b = new Bundle(); if (uri != null) { @@ -383,24 +384,27 @@ public abstract class SliceProvider extends ContentProvider { } else if (method.equals(METHOD_MAP_ONLY_INTENT)) { Intent intent = extras.getParcelable(EXTRA_INTENT); if (intent == null) return null; - Uri uri = onMapIntentToUri(intent); + Uri uri = validateIncomingUriOrNull(onMapIntentToUri(intent)); Bundle b = new Bundle(); b.putParcelable(EXTRA_SLICE, uri); return b; } else if (method.equals(METHOD_PIN)) { - Uri uri = getUriWithoutUserId(extras.getParcelable(EXTRA_BIND_URI)); + Uri uri = getUriWithoutUserId(validateIncomingUriOrNull( + extras.getParcelable(EXTRA_BIND_URI))); if (Binder.getCallingUid() != Process.SYSTEM_UID) { throw new SecurityException("Only the system can pin/unpin slices"); } handlePinSlice(uri); } else if (method.equals(METHOD_UNPIN)) { - Uri uri = getUriWithoutUserId(extras.getParcelable(EXTRA_BIND_URI)); + Uri uri = getUriWithoutUserId(validateIncomingUriOrNull( + extras.getParcelable(EXTRA_BIND_URI))); if (Binder.getCallingUid() != Process.SYSTEM_UID) { throw new SecurityException("Only the system can pin/unpin slices"); } handleUnpinSlice(uri); } else if (method.equals(METHOD_GET_DESCENDANTS)) { - Uri uri = getUriWithoutUserId(extras.getParcelable(EXTRA_BIND_URI)); + Uri uri = getUriWithoutUserId( + validateIncomingUriOrNull(extras.getParcelable(EXTRA_BIND_URI))); Bundle b = new Bundle(); b.putParcelableArrayList(EXTRA_SLICE_DESCENDANTS, new ArrayList<>(handleGetDescendants(uri))); @@ -416,6 +420,10 @@ public abstract class SliceProvider extends ContentProvider { return super.call(method, arg, extras); } + private Uri validateIncomingUriOrNull(Uri uri) { + return uri == null ? null : validateIncomingUri(uri); + } + private Collection<Uri> handleGetDescendants(Uri uri) { mCallback = "onGetSliceDescendants"; return onGetSliceDescendants(uri); diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index a6b95a95dcd8..4a5ea03b4530 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -854,11 +854,16 @@ public abstract class Context { * to any callers for the same name, meaning they will see each other's * edits as soon as they are made. * - * This method is thead-safe. + * <p>This method is thread-safe. * - * @param name Desired preferences file. If a preferences file by this name - * does not exist, it will be created when you retrieve an - * editor (SharedPreferences.edit()) and then commit changes (Editor.commit()). + * <p>If the preferences directory does not already exist, it will be created when this method + * is called. + * + * <p>If a preferences file by this name does not exist, it will be created when you retrieve an + * editor ({@link SharedPreferences#edit()}) and then commit changes ({@link + * SharedPreferences.Editor#commit()} or {@link SharedPreferences.Editor#apply()}). + * + * @param name Desired preferences file. * @param mode Operating mode. * * @return The single {@link SharedPreferences} instance that can be used diff --git a/core/java/android/content/pm/LauncherApps.java b/core/java/android/content/pm/LauncherApps.java index 037a149bfe37..c74daa8eadfc 100644 --- a/core/java/android/content/pm/LauncherApps.java +++ b/core/java/android/content/pm/LauncherApps.java @@ -503,9 +503,38 @@ public class LauncherApps { } /** - * Retrieves a list of launchable activities that match {@link Intent#ACTION_MAIN} and - * {@link Intent#CATEGORY_LAUNCHER}, for a specified user. Result may include - * synthesized activities like app details Activity injected by system. + * Retrieves a list of activities that specify {@link Intent#ACTION_MAIN} and + * {@link Intent#CATEGORY_LAUNCHER}, across all apps, for a specified user. If an app doesn't + * have any activities that specify <code>ACTION_MAIN</code> or <code>CATEGORY_LAUNCHER</code>, + * the system adds a synthesized activity to the list. This synthesized activity represents the + * app's details page within system settings. + * + * <p class="note"><b>Note: </b>It's possible for system apps, such as app stores, to prevent + * the system from adding synthesized activities to the returned list.</p> + * + * <p>As of <a href="/reference/android/os/Build.VERSION_CODES.html#Q">Android Q</a>, at least + * one of the app's activities or synthesized activities appears in the returned list unless the + * app satisfies at least one of the following conditions:</p> + * <ul> + * <li>The app is a system app.</li> + * <li>The app doesn't request any <a href="/guide/topics/permissions/overview">permissions</a>. + * </li> + * <li>The <code><application></code> tag in the app's manifest doesn't contain any child + * elements that represent + * <a href="/guide/components/fundamentals#DeclaringComponents">app components</a>.</li> + * </ul> + * + * <p>Additionally, the system hides synthesized activities for some or all apps in the + * following enterprise-related cases:</p> + * <ul> + * <li>If the device is a + * <a href="https://developers.google.com/android/work/overview#company-owned-devices-for-knowledge-workers">fully + * managed device</a>, no synthesized activities for any app appear in the returned list.</li> + * <li>If the current user has a + * <a href="https://developers.google.com/android/work/overview#employee-owned-devices-byod">work + * profile</a>, no synthesized activities for the user's work apps appear in the returned + * list.</li> + * </ul> * * @param packageName The specific package to query. If null, it checks all installed packages * in the profile. diff --git a/core/java/android/hardware/Sensor.java b/core/java/android/hardware/Sensor.java index 099ae291c8f4..e78fb7f00797 100644 --- a/core/java/android/hardware/Sensor.java +++ b/core/java/android/hardware/Sensor.java @@ -339,6 +339,8 @@ public final class Sensor { * for {@link #TYPE_STEP_COUNTER} instead. It is defined as a * {@link Sensor#REPORTING_MODE_SPECIAL_TRIGGER} sensor. * <p> + * This sensor requires permission {@code android.permission.ACTIVITY_RECOGNITION}. + * <p> * See {@link android.hardware.SensorEvent#values SensorEvent.values} for more details. */ public static final int TYPE_STEP_DETECTOR = 18; @@ -384,8 +386,6 @@ public final class Sensor { * gyroscope. This sensor uses lower power than the other rotation vectors, because it doesn't * use the gyroscope. However, it is more noisy and will work best outdoors. * <p> - * This sensor requires permission {@code android.permission.ACTIVITY_RECOGNITION}. - * <p> * See {@link android.hardware.SensorEvent#values SensorEvent.values} for more details. */ public static final int TYPE_GEOMAGNETIC_ROTATION_VECTOR = 20; diff --git a/core/java/android/os/SharedMemory.java b/core/java/android/os/SharedMemory.java index 7df4b5d8f63b..57a88012a31a 100644 --- a/core/java/android/os/SharedMemory.java +++ b/core/java/android/os/SharedMemory.java @@ -25,8 +25,6 @@ import android.system.OsConstants; import dalvik.system.VMRuntime; -import libcore.io.IoUtils; - import java.io.Closeable; import java.io.FileDescriptor; import java.nio.ByteBuffer; @@ -64,7 +62,7 @@ public final class SharedMemory implements Parcelable, Closeable { mMemoryRegistration = new MemoryRegistration(mSize); mCleaner = Cleaner.create(mFileDescriptor, - new Closer(mFileDescriptor.getInt$(), mMemoryRegistration)); + new Closer(mFileDescriptor, mMemoryRegistration)); } /** @@ -261,9 +259,6 @@ public final class SharedMemory implements Parcelable, Closeable { mCleaner.clean(); mCleaner = null; } - - // Cleaner.clean doesn't clear the value of the file descriptor. - mFileDescriptor.setInt$(-1); } @Override @@ -295,24 +290,19 @@ public final class SharedMemory implements Parcelable, Closeable { * Cleaner that closes the FD */ private static final class Closer implements Runnable { - // This is a copy of the FileDescriptor we're attached to, in order to avoid a reference - // cycle. private FileDescriptor mFd; private MemoryRegistration mMemoryReference; - private Closer(int fd, MemoryRegistration memoryReference) { - mFd = new FileDescriptor(); - mFd.setInt$(fd); - IoUtils.setFdOwner(mFd, this); - + private Closer(FileDescriptor fd, MemoryRegistration memoryReference) { + mFd = fd; mMemoryReference = memoryReference; } @Override public void run() { - IoUtils.closeQuietly(mFd); - mFd = null; - + try { + Os.close(mFd); + } catch (ErrnoException e) { /* swallow error */ } mMemoryReference.release(); mMemoryReference = null; } diff --git a/core/java/android/os/VibrationEffect.java b/core/java/android/os/VibrationEffect.java index 702b41beb071..26da0a0aee07 100644 --- a/core/java/android/os/VibrationEffect.java +++ b/core/java/android/os/VibrationEffect.java @@ -53,7 +53,7 @@ public abstract class VibrationEffect implements Parcelable { public static final int MAX_AMPLITUDE = 255; /** - * A click effect. + * A click effect. Use this effect as a baseline, as it's the most common type of click effect. * * @see #get(int) */ @@ -67,7 +67,7 @@ public abstract class VibrationEffect implements Parcelable { public static final int EFFECT_DOUBLE_CLICK = Effect.DOUBLE_CLICK; /** - * A tick effect. + * A tick effect. This effect is less strong compared to {@link #EFFECT_CLICK}. * @see #get(int) */ public static final int EFFECT_TICK = Effect.TICK; @@ -89,7 +89,7 @@ public abstract class VibrationEffect implements Parcelable { public static final int EFFECT_POP = Effect.POP; /** - * A heavy click effect. + * A heavy click effect. This effect is stronger than {@link #EFFECT_CLICK}. * @see #get(int) */ public static final int EFFECT_HEAVY_CLICK = Effect.HEAVY_CLICK; diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java index 81e1eb99336b..af3a16c987e6 100644 --- a/core/java/android/provider/ContactsContract.java +++ b/core/java/android/provider/ContactsContract.java @@ -870,8 +870,8 @@ public final class ContactsContract { protected interface ContactOptionsColumns { /** * The number of times a contact has been contacted. - * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field is obsolete. For - * more information, see the + * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store, + * this field is obsolete, regardless of Android version. For more information, see the * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> * page.</p> * <P>Type: INTEGER</P> @@ -885,8 +885,8 @@ public final class ContactsContract { /** * The last time a contact was contacted. - * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field is obsolete. For - * more information, see the + * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store, + * this field is obsolete, regardless of Android version. For more information, see the * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> * page.</p> * <P>Type: INTEGER</P> @@ -1691,10 +1691,10 @@ public final class ContactsContract { * TIMES_CONTACTED field is incremented by 1 and the LAST_TIME_CONTACTED * field is populated with the current system time. * - * <p class="caution"><b>Caution: </b>As of January 7, 2019, this method is obsolete. For - * more information, see the + * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store, + * this field is obsolete, regardless of Android version. For more information, see the * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> - * page. + * page.</p> * * @param resolver the ContentResolver to use * @param contactId the person who was contacted @@ -1730,8 +1730,8 @@ public final class ContactsContract { * Frequent contacts are no longer included in the result as of * Android version {@link android.os.Build.VERSION_CODES#Q}. * - * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer sorts - * results based on contacts frequency. For more information, see the + * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store, this + * field doesn't sort results based on contacts frequency. For more information, see the * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> * page. */ @@ -1745,8 +1745,8 @@ public final class ContactsContract { * Android version {@link android.os.Build.VERSION_CODES#Q}. * This URI always returns an empty cursor. * - * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer sorts - * results based on contacts frequency. For more information, see the + * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store, this + * field doesn't sort results based on contacts frequency. For more information, see the * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> * page. */ @@ -1760,8 +1760,8 @@ public final class ContactsContract { * various parts of the contact name. The filter argument should be passed * as an additional path segment after this URI. * - * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer sorts - * results based on contacts frequency. For more information, see the + * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store, this + * field doesn't sort results based on contacts frequency. For more information, see the * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> * page. */ @@ -4292,10 +4292,10 @@ public final class ContactsContract { * Android version {@link android.os.Build.VERSION_CODES#Q}. * This column always contains 0. * - * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field is obsolete. - * For more information, see the + * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store, + * this field is obsolete, regardless of Android version. For more information, see the * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> - * page. + * page.</p> */ @Deprecated public static final String LAST_TIME_USED = "last_time_used"; @@ -4306,10 +4306,10 @@ public final class ContactsContract { * Android version {@link android.os.Build.VERSION_CODES#Q}. * This column always contains 0. * - * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field is obsolete. - * For more information, see the + * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store, + * this field is obsolete, regardless of Android version. For more information, see the * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> - * page. + * page.</p> */ @Deprecated public static final String TIMES_USED = "times_used"; @@ -5259,8 +5259,8 @@ public final class ContactsContract { /** * The content:// style URI for this table. * - * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer - * sorts results based on contacts frequency. For more information, see the + * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store, this + * field doesn't sort results based on contacts frequency. For more information, see the * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> * page. * @@ -5277,8 +5277,8 @@ public final class ContactsContract { /** * <p>URI used for the "enterprise caller-id".</p> * - * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer - * sorts results based on contacts frequency. For more information, see the + * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store, this + * field doesn't sort results based on contacts frequency. For more information, see the * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> * page. * @@ -6079,8 +6079,8 @@ public final class ContactsContract { * to display names as well as phone numbers. The filter argument should be passed * as an additional path segment after this URI. * - * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer - * sorts results based on contacts frequency. For more information, see the + * <p class="caution"><b>Caution: </b>This field deosn't sort results based on contacts + * frequency. For more information, see the * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> * page. */ @@ -6092,8 +6092,9 @@ public final class ContactsContract { * same columns. This URI requires {@link ContactsContract#DIRECTORY_PARAM_KEY} in * parameters, otherwise it will throw IllegalArgumentException. * - * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer sorts - * results based on contacts frequency. For more information, see the + * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store, + * this field doesn't sort results based on contacts frequency. For more information, + * see the * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> * page. */ @@ -6360,8 +6361,9 @@ public final class ContactsContract { * as an additional path segment after this URI. * </p> * - * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer sorts - * results based on contacts frequency. For more information, see the + * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store, + * this field doesn't sort results based on contacts frequency. For more information, + * see the * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> * page.</p> * @@ -6383,8 +6385,9 @@ public final class ContactsContract { * same columns. This URI requires {@link ContactsContract#DIRECTORY_PARAM_KEY} in * parameters, otherwise it will throw IllegalArgumentException. * - * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer - * sorts results based on contacts frequency. For more information, see the + * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store, + * this field doesn't sort results based on contacts frequency. For more information, + * see the * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> * page. */ @@ -7602,8 +7605,8 @@ public final class ContactsContract { * <p>Similar to {@link Phone#CONTENT_FILTER_URI}, but allows users to filter callable * data. * - * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer - * sorts results based on contacts frequency. For more information, see the + * <p class="caution"><b>Caution: </b>This field no longer sorts results based on + * contacts frequency. For more information, see the * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> * page. */ @@ -7615,8 +7618,9 @@ public final class ContactsContract { * callable data. This URI requires {@link ContactsContract#DIRECTORY_PARAM_KEY} in * parameters, otherwise it will throw IllegalArgumentException. * - * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer - * sorts results based on contacts frequency. For more information, see the + * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store, + * this field doesn't sort results based on contacts frequency. For more information, + * see the * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> * page.</p> */ @@ -7646,8 +7650,9 @@ public final class ContactsContract { * <p>The content:// style URI for these data items, which allows for a query parameter * to be appended onto the end to filter for data items matching the query. * - * <p class="caution"><b>Caution: </b>As of January 7, 2019, this field no longer - * sorts results based on contacts frequency. For more information, see the + * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store, + * this field doesn't sort results based on contacts frequency. For more information, + * see the * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> * page. */ @@ -8298,15 +8303,14 @@ public final class ContactsContract { } /** - * <p class="caution"><b>Caution: </b>As of January 7, 2019, this class is obsolete. For - * more information, see the - * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> - * page. - * </p> * <p> * API allowing applications to send usage information for each {@link Data} row to the * Contacts Provider. Applications can also clear all usage information. * </p> + * <p class="caution"><b>Caution: </b>If you publish your app to the Google Play Store, + * this field is obsolete, regardless of Android version. For more information, see the + * <a href="/guide/topics/providers/contacts-provider#ObsoleteData">Contacts Provider</a> + * page.</p> * <p> * With the feedback, Contacts Provider may return more contextually appropriate results for * Data listing, typically supplied with diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 1275e46ed421..e3db475d6681 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -10571,6 +10571,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * * <p>Do not modify the provided list after this method is called.</p> * + * <p>Note: the system will put a limit of <code>200dp</code> on the vertical extent of the + * exclusions it takes into account. The limit does not apply while the navigation + * bar is {@link #SYSTEM_UI_FLAG_IMMERSIVE_STICKY stickily} hidden, nor to the + * {@link android.inputmethodservice.InputMethodService input method} and + * {@link Intent#CATEGORY_HOME home activity}. + * </p> + * * @param rects A list of precision gesture regions that this view needs to function correctly */ public void setSystemGestureExclusionRects(@NonNull List<Rect> rects) { diff --git a/core/java/android/view/WindowInsets.java b/core/java/android/view/WindowInsets.java index 9340b71a5280..bcc6a552f569 100644 --- a/core/java/android/view/WindowInsets.java +++ b/core/java/android/view/WindowInsets.java @@ -35,6 +35,7 @@ import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.UnsupportedAppUsage; +import android.content.Intent; import android.graphics.Insets; import android.graphics.Rect; import android.util.SparseArray; @@ -644,6 +645,14 @@ public final class WindowInsets { * {@link View#setSystemGestureExclusionRects} outside of the * {@link #getMandatorySystemGestureInsets() mandatory system gesture insets}. * + * <p>Note: the system will put a limit of <code>200dp</code> on the vertical extent of the + * exclusions it takes into account. The limit does not apply while the navigation + * bar is {@link View#SYSTEM_UI_FLAG_IMMERSIVE_STICKY stickily} hidden, nor to the + * {@link android.inputmethodservice.InputMethodService input method} and + * {@link Intent#CATEGORY_HOME home activity}. + * </p> + * + * * <p>Simple taps are guaranteed to reach the window even within the system gesture insets, * as long as they are outside the {@link #getTappableElementInsets() system window insets}. * diff --git a/core/java/android/view/accessibility/TEST_MAPPING b/core/java/android/view/accessibility/TEST_MAPPING index 535a31a908a0..d2bd6ea2b702 100644 --- a/core/java/android/view/accessibility/TEST_MAPPING +++ b/core/java/android/view/accessibility/TEST_MAPPING @@ -30,9 +30,6 @@ }, { "exclude-annotation": "androidx.test.filters.FlakyTest" - }, - { - "exclude-filter": "android.view.textclassifier.TextClassifierTest#testSuggetsConversationActions_deduplicate" } ] } diff --git a/core/java/android/view/textclassifier/TEST_MAPPING b/core/java/android/view/textclassifier/TEST_MAPPING index 31e240bf55bb..01a6edecf21e 100644 --- a/core/java/android/view/textclassifier/TEST_MAPPING +++ b/core/java/android/view/textclassifier/TEST_MAPPING @@ -8,9 +8,6 @@ }, { "exclude-annotation": "androidx.test.filters.FlakyTest" - }, - { - "exclude-filter": "android.view.textclassifier.TextClassifierTest#testSuggetsConversationActions_deduplicate" } ] } diff --git a/core/java/android/webkit/PermissionRequest.java b/core/java/android/webkit/PermissionRequest.java index 18ec334d0283..ac145b1d81a5 100644 --- a/core/java/android/webkit/PermissionRequest.java +++ b/core/java/android/webkit/PermissionRequest.java @@ -32,7 +32,7 @@ import android.net.Uri; * avoid unintentionally granting requests for new permissions, you should pass the * specific permissions you intend to grant to {@link #grant(String[]) grant()}, * and avoid writing code like this example: - * <pre> + * <pre class="prettyprint"> * permissionRequest.grant(permissionRequest.getResources()) // This is wrong!!! * </pre> * See the WebView's release notes for information about new protected resources. diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java index 95fe963d7891..4db630808ef1 100644 --- a/core/java/android/webkit/WebChromeClient.java +++ b/core/java/android/webkit/WebChromeClient.java @@ -519,15 +519,17 @@ public class WebChromeClient { * may not be supported and applications wishing to support these sources * or more advanced file operations should build their own Intent. * - * <pre> - * How to use: - * 1. Build an intent using {@link #createIntent} - * 2. Fire the intent using {@link android.app.Activity#startActivityForResult}. - * 3. Check for ActivityNotFoundException and take a user friendly action if thrown. - * 4. Listen the result using {@link android.app.Activity#onActivityResult} - * 5. Parse the result using {@link #parseResult} only if media capture was not requested. - * 6. Send the result using filePathCallback of {@link WebChromeClient#onShowFileChooser} - * </pre> + * <p>How to use: + * <ol> + * <li>Build an intent using {@link #createIntent}</li> + * <li>Fire the intent using {@link android.app.Activity#startActivityForResult}.</li> + * <li>Check for ActivityNotFoundException and take a user friendly action if thrown.</li> + * <li>Listen the result using {@link android.app.Activity#onActivityResult}</li> + * <li>Parse the result using {@link #parseResult} only if media capture was not + * requested.</li> + * <li>Send the result using filePathCallback of {@link + * WebChromeClient#onShowFileChooser}</li> + * </ol> * * @return an Intent that supports basic file chooser sources. */ diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java index a46580dcc539..18d4d691f726 100644 --- a/core/java/android/webkit/WebSettings.java +++ b/core/java/android/webkit/WebSettings.java @@ -464,7 +464,9 @@ public abstract class WebSettings { * Note that the feature will continue to be supported on older versions of * Android as before. * - * This function does not have any effect. + * @deprecated In Android O and afterwards, this function does not have + * any effect, the form data will be saved to platform's autofill service + * if applicable. */ @Deprecated public abstract void setSaveFormData(boolean save); diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 14be73dec41c..c50c08ead195 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -759,7 +759,7 @@ public class WebView extends AbsoluteLayout * encoded. If the data is base64 encoded, the value of the encoding * parameter must be {@code "base64"}. HTML can be encoded with {@link * android.util.Base64#encodeToString(byte[],int)} like so: - * <pre> + * <pre class="prettyprint"> * String unencodedHtml = * "<html><body>'%28' is the code for '('</body></html>"; * String encodedHtml = Base64.encodeToString(unencodedHtml.getBytes(), Base64.NO_PADDING); @@ -1840,8 +1840,8 @@ public class WebView extends AbsoluteLayout /** * Injects the supplied Java object into this WebView. The object is - * injected into the JavaScript context of the main frame, using the - * supplied name. This allows the Java object's methods to be + * injected into all frames of the web page, including all the iframes, + * using the supplied name. This allows the Java object's methods to be * accessed from JavaScript. For applications targeted to API * level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} * and above, only public methods that are annotated with @@ -1851,7 +1851,7 @@ public class WebView extends AbsoluteLayout * important security note below for implications. * <p> Note that injected objects will not appear in JavaScript until the page is next * (re)loaded. JavaScript should be enabled before injecting the object. For example: - * <pre> + * <pre class="prettyprint"> * class JsObject { * {@literal @}JavascriptInterface * public String toString() { return "injectedObject"; } @@ -1880,6 +1880,11 @@ public class WebView extends AbsoluteLayout * thread of this WebView. Care is therefore required to maintain thread * safety. * </li> + * <li> Because the object is exposed to all the frames, any frame could + * obtain the object name and call methods on it. There is no way to tell the + * calling frame's origin from the app side, so the app must not assume that + * the caller is trustworthy unless the app can guarantee that no third party + * content is ever loaded into the WebView even inside an iframe.</li> * <li> The Java object's fields are not accessible.</li> * <li> For applications targeted to API level {@link android.os.Build.VERSION_CODES#LOLLIPOP} * and above, methods of injected Java objects are enumerable from diff --git a/core/java/android/widget/ArrayAdapter.java b/core/java/android/widget/ArrayAdapter.java index c3c2c0db9a77..2bf1ba5cf017 100644 --- a/core/java/android/widget/ArrayAdapter.java +++ b/core/java/android/widget/ArrayAdapter.java @@ -50,7 +50,7 @@ import java.util.List; * override {@link #getView(int, View, ViewGroup)} * and inflate a view resource. * For a code example, see - * the <a href="https://developer.android.com/samples/CustomChoiceList/index.html"> + * the <a href="https://github.com/googlesamples/android-CustomChoiceList/#readme"> * CustomChoiceList</a> sample. * </p> * <p> diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java index be5d2211c670..d62b979a2ed3 100644 --- a/core/java/android/widget/ImageView.java +++ b/core/java/android/widget/ImageView.java @@ -62,8 +62,9 @@ import java.io.IOException; /** * Displays image resources, for example {@link android.graphics.Bitmap} * or {@link android.graphics.drawable.Drawable} resources. - * ImageView is also commonly used to {@link #setImageTintMode(PorterDuff.Mode) - * apply tints to an image} and handle {@link #setScaleType(ScaleType) image scaling}. + * ImageView is also commonly used to + * <a href="#setImageTintMode(android.graphics.PorterDuff.Mode)">apply tints to an image</a> and + * handle <a href="#setScaleType(android.widget.ImageView.ScaleType)">image scaling</a>. * * <p> * The following XML snippet is a common example of using an ImageView to display an image resource: @@ -76,7 +77,8 @@ import java.io.IOException; * <ImageView * android:layout_width="wrap_content" * android:layout_height="wrap_content" - * android:src="@mipmap/ic_launcher" + * android:src="@drawable/my_image" + * android:contentDescription="@string/my_image_description" * /> * </LinearLayout> * </pre> diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java index d985528c38fb..6b324a541c42 100644 --- a/core/java/android/widget/RelativeLayout.java +++ b/core/java/android/widget/RelativeLayout.java @@ -1202,13 +1202,13 @@ public class RelativeLayout extends ViewGroup { * determine where to position the view on the screen. If the view is not contained * within a relative layout, these attributes are ignored. * - * See the <a href="/guide/topics/ui/layout/relative.html"> - * Relative Layout</a> guide for example code demonstrating how to use relative layout’s + * See the <a href="{@docRoot}guide/topics/ui/layout/relative.html">Relative + * Layout</a> guide for example code demonstrating how to use relative layout's * layout parameters in a layout XML. * * To learn more about layout parameters and how they differ from typical view attributes, - * see the <a href="/guide/topics/ui/declaring-layout.html#attributes"> - * Layouts guide</a>. + * see the <a href="{@docRoot}guide/topics/ui/declaring-layout.html#attributes">Layouts + * guide</a>. * * * @attr ref android.R.styleable#RelativeLayout_Layout_layout_alignWithParentIfMissing diff --git a/core/java/android/widget/TabWidget.java b/core/java/android/widget/TabWidget.java index 49a0f39b3bad..4c67b080252a 100644 --- a/core/java/android/widget/TabWidget.java +++ b/core/java/android/widget/TabWidget.java @@ -433,7 +433,7 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { * to the next tabbed view, in this example). * <p> * To move both the focus AND the selected tab at once, please use - * {@link #setCurrentTab}. Normally, the view logic takes care of + * {@link #focusCurrentTab}. Normally, the view logic takes care of * adjusting the focus, so unless you're circumventing the UI, * you'll probably just focus your interest here. * diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 02eed9a7bcf7..e7e20fc41eee 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -724,6 +724,10 @@ <!-- Allows an application to send SMS messages. <p>Protection level: dangerous + + <p> This is a hard restricted permission which cannot be held by an app until + the installer on record whitelists the permission. For more details see + {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. --> <permission android:name="android.permission.SEND_SMS" android:permissionGroup="android.permission-group.UNDEFINED" @@ -734,6 +738,10 @@ <!-- Allows an application to receive SMS messages. <p>Protection level: dangerous + + <p> This is a hard restricted permission which cannot be held by an app until + the installer on record whitelists the permission. For more details see + {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. --> <permission android:name="android.permission.RECEIVE_SMS" android:permissionGroup="android.permission-group.UNDEFINED" @@ -744,6 +752,10 @@ <!-- Allows an application to read SMS messages. <p>Protection level: dangerous + + <p> This is a hard restricted permission which cannot be held by an app until + the installer on record whitelists the permission. For more details see + {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. --> <permission android:name="android.permission.READ_SMS" android:permissionGroup="android.permission-group.UNDEFINED" @@ -754,6 +766,10 @@ <!-- Allows an application to receive WAP push messages. <p>Protection level: dangerous + + <p> This is a hard restricted permission which cannot be held by an app until + the installer on record whitelists the permission. For more details see + {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. --> <permission android:name="android.permission.RECEIVE_WAP_PUSH" android:permissionGroup="android.permission-group.UNDEFINED" @@ -763,7 +779,11 @@ android:protectionLevel="dangerous" /> <!-- Allows an application to monitor incoming MMS messages. - <p>Protection level: dangerous + <p>Protection level: dangerous + + <p> This is a hard restricted permission which cannot be held by an app until + the installer on record whitelists the permission. For more details see + {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. --> <permission android:name="android.permission.RECEIVE_MMS" android:permissionGroup="android.permission-group.UNDEFINED" @@ -783,6 +803,11 @@ when the alert is first received, and to delay presenting the info to the user until after the initial alert dialog is dismissed. <p>Protection level: dangerous + + <p> This is a hard restricted permission which cannot be held by an app until + the installer on record whitelists the permission. For more details see + {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. + @hide Pending API council approval --> <permission android:name="android.permission.READ_CELL_BROADCASTS" android:permissionGroup="android.permission-group.UNDEFINED" @@ -805,31 +830,36 @@ android:priority="900" /> <!-- Allows an application to read from external storage. - <p>Any app that declares the {@link #WRITE_EXTERNAL_STORAGE} permission is implicitly - granted this permission.</p> - <p>This permission is enforced starting in API level 19. Before API level 19, this - permission is not enforced and all apps still have access to read from external storage. - You can test your app with the permission enforced by enabling <em>Protect USB - storage</em> under Developer options in the Settings app on a device running Android 4.1 or - higher.</p> - <p>Also starting in API level 19, this permission is <em>not</em> required to - read/write files in your application-specific directories returned by - {@link android.content.Context#getExternalFilesDir} and - {@link android.content.Context#getExternalCacheDir}. - <p class="note"><strong>Note:</strong> If <em>both</em> your <a - href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code - minSdkVersion}</a> and <a - href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code - targetSdkVersion}</a> values are set to 3 or lower, the system implicitly - grants your app this permission. If you don't need this permission, be sure your <a - href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code - targetSdkVersion}</a> is 4 or higher. - <p>Is this permission is not whitelisted for an app that targets an API level before - {@link android.os.Build.VERSION_CODES#Q} this permission cannot be granted to apps.</p> - <p>Is this permission is not whitelisted for an app that targets an API level - {@link android.os.Build.VERSION_CODES#Q} or later the app will be forced into isolated storage. - </p> - --> + <p>Any app that declares the {@link #WRITE_EXTERNAL_STORAGE} permission is implicitly + granted this permission.</p> + <p>This permission is enforced starting in API level 19. Before API level 19, this + permission is not enforced and all apps still have access to read from external storage. + You can test your app with the permission enforced by enabling <em>Protect USB + storage</em> under Developer options in the Settings app on a device running Android 4.1 or + higher.</p> + <p>Also starting in API level 19, this permission is <em>not</em> required to + read/write files in your application-specific directories returned by + {@link android.content.Context#getExternalFilesDir} and + {@link android.content.Context#getExternalCacheDir}. + <p class="note"><strong>Note:</strong> If <em>both</em> your <a + href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code + minSdkVersion}</a> and <a + href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code + targetSdkVersion}</a> values are set to 3 or lower, the system implicitly + grants your app this permission. If you don't need this permission, be sure your <a + href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code + targetSdkVersion}</a> is 4 or higher. + + <p> This is a soft restricted permission which cannot be held by an app it its + full form until the installer on record whitelists the permission. + Specifically, if the permission is whitelisted the holder app can access + external storage and the visual and aural media collections while if the + permission is not whitelisted the holder app can only access to the visual + and aural medial collections. Also the permission is immutably restricted + meaning that the whitelist state can be specified only at install time and + cannot change until the app is installed. For more details see + {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. + <p>Protection level: dangerous --> <permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_sdcardRead" @@ -850,8 +880,9 @@ read/write files in your application-specific directories returned by {@link android.content.Context#getExternalFilesDir} and {@link android.content.Context#getExternalCacheDir}. - <p>Is this permission is not whitelisted for an app that targets an API level before + <p>If this permission is not whitelisted for an app that targets an API level before {@link android.os.Build.VERSION_CODES#Q} this permission cannot be granted to apps.</p> + <p>Protection level: dangerous</p> --> <permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:permissionGroup="android.permission-group.UNDEFINED" @@ -861,7 +892,8 @@ android:protectionLevel="dangerous" /> <!-- Allows an application to access any geographic locations persisted in the - user's shared collection. --> + user's shared collection. + <p>Protection level: dangerous --> <permission android:name="android.permission.ACCESS_MEDIA_LOCATION" android:permissionGroup="android.permission-group.UNDEFINED" android:label="@string/permlab_mediaLocation" @@ -916,6 +948,10 @@ {@link #ACCESS_FINE_LOCATION}. Requesting this permission by itself doesn't give you location access. <p>Protection level: dangerous + + <p> This is a hard restricted permission which cannot be held by an app until + the installer on record whitelists the permission. For more details see + {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. --> <permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" android:permissionGroup="android.permission-group.UNDEFINED" @@ -958,6 +994,10 @@ href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code targetSdkVersion}</a> is 16 or higher.</p> <p>Protection level: dangerous + + <p> This is a hard restricted permission which cannot be held by an app until + the installer on record whitelists the permission. For more details see + {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. --> <permission android:name="android.permission.READ_CALL_LOG" android:permissionGroup="android.permission-group.UNDEFINED" @@ -978,6 +1018,10 @@ href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code targetSdkVersion}</a> is 16 or higher.</p> <p>Protection level: dangerous + + <p> This is a hard restricted permission which cannot be held by an app until + the installer on record whitelists the permission. For more details see + {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. --> <permission android:name="android.permission.WRITE_CALL_LOG" android:permissionGroup="android.permission-group.UNDEFINED" @@ -991,6 +1035,10 @@ abort the call altogether. <p>Protection level: dangerous + <p> This is a hard restricted permission which cannot be held by an app until + the installer on record whitelists the permission. For more details see + {@link android.content.pm.PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set)}. + @deprecated Applications should use {@link android.telecom.CallRedirectionService} instead of the {@link android.content.Intent#ACTION_NEW_OUTGOING_CALL} broadcast. --> @@ -1665,7 +1713,7 @@ <!-- Allows applications to pair bluetooth devices without user interaction, and to allow or disallow phonebook access or message access. - This is not available to third party applications. --> + <p>Not for use by third-party applications. --> <permission android:name="android.permission.BLUETOOTH_PRIVILEGED" android:protectionLevel="signature|privileged" /> @@ -2515,7 +2563,8 @@ android:protectionLevel="signature" /> <!-- Allows an application to modify the current configuration, such - as locale. --> + as locale. + <p>Protection level: signature|privileged|development --> <permission android:name="android.permission.CHANGE_CONFIGURATION" android:protectionLevel="signature|privileged|development" /> @@ -2814,7 +2863,8 @@ <!-- ==================================== --> <eat-comment /> - <!-- Allows access to the list of accounts in the Accounts Service. --> + <!-- Allows access to the list of accounts in the Accounts Service. + <p>Protection level: signature|privileged --> <permission android:name="android.permission.GET_ACCOUNTS_PRIVILEGED" android:protectionLevel="signature|privileged" /> @@ -3393,7 +3443,8 @@ android:protectionLevel="signature" /> <!-- Old permission for deleting an app's cache files, no longer used, - but signals for us to quietly ignore calls instead of throwing an exception. --> + but signals for us to quietly ignore calls instead of throwing an exception. + <p>Protection level: signature|privileged --> <permission android:name="android.permission.DELETE_CACHE_FILES" android:protectionLevel="signature|privileged" /> @@ -3751,7 +3802,8 @@ <!-- Allows an application to collect component usage statistics <p>Declaring the permission implies intention to use the API and the user of the - device can grant permission through the Settings application. --> + device can grant permission through the Settings application. + <p>Protection level: signature|privileged|development|appop --> <permission android:name="android.permission.PACKAGE_USAGE_STATS" android:protectionLevel="signature|privileged|development|appop" /> <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" /> @@ -3774,14 +3826,14 @@ <!-- Permission an application must hold in order to use {@link android.provider.Settings#ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS}. - This is a normal permission: an app requesting it will always be granted the - permission, without the user needing to approve or see it. --> + <p>Protection level: normal --> <permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" android:label="@string/permlab_requestIgnoreBatteryOptimizations" android:description="@string/permdesc_requestIgnoreBatteryOptimizations" android:protectionLevel="normal" /> - <!-- Allows an application to collect battery statistics --> + <!-- Allows an application to collect battery statistics + <p>Protection level: signature|privileged|development --> <permission android:name="android.permission.BATTERY_STATS" android:protectionLevel="signature|privileged|development" /> @@ -3811,7 +3863,8 @@ android:protectionLevel="signature" /> <!-- Must be required by a {@link android.widget.RemoteViewsService}, - to ensure that only the system can bind to it. --> + to ensure that only the system can bind to it. + <p>Protection level: signature|privileged --> <permission android:name="android.permission.BIND_REMOTEVIEWS" android:protectionLevel="signature|privileged" /> @@ -3853,7 +3906,8 @@ to the path in the provider where global search queries are performed. This permission can not be held by regular applications; it is used by applications to protect themselves from everyone else - besides global search. --> + besides global search. + <p>Protection level: signature|privileged --> <permission android:name="android.permission.GLOBAL_SEARCH" android:protectionLevel="signature|privileged" /> @@ -4392,7 +4446,8 @@ <permission android:name="android.permission.MODIFY_THEME_OVERLAY" android:protectionLevel="signature" /> - <!-- Allows an instant app to create foreground services. --> + <!-- Allows an instant app to create foreground services. + <p>Protection level: signature|development|instant|appop --> <permission android:name="android.permission.INSTANT_APP_FOREGROUND_SERVICE" android:protectionLevel="signature|development|instant|appop" /> @@ -4462,7 +4517,8 @@ <permission android:name="android.permission.MONITOR_DEFAULT_SMS_PACKAGE" android:protectionLevel="signature|privileged" /> - <!-- A subclass of {@link android.service.carrier.CarrierMessagingClientService} must be protected with this permission. --> + <!-- A subclass of {@link android.service.carrier.CarrierMessagingClientService} must be protected with this permission. + <p>Protection level: signature --> <permission android:name="android.permission.BIND_CARRIER_MESSAGING_CLIENT_SERVICE" android:protectionLevel="signature" /> @@ -4494,13 +4550,15 @@ <permission android:name="android.permission.GRANT_PROFILE_OWNER_DEVICE_IDS_ACCESS" android:protectionLevel="signature" /> - <!-- Allows financial apps to read filtered sms messages. --> + <!-- Allows financial apps to read filtered sms messages. + Protection level: signature|appop --> <permission android:name="android.permission.SMS_FINANCIAL_TRANSACTIONS" android:protectionLevel="signature|appop" /> <!-- Required for apps targeting {@link android.os.Build.VERSION_CODES#Q} that want to use {@link android.app.Notification.Builder#setFullScreenIntent notification full screen - intents}. --> + intents}. + <p>Protection level: normal --> <permission android:name="android.permission.USE_FULL_SCREEN_INTENT" android:protectionLevel="normal" /> diff --git a/graphics/java/android/graphics/RectF.java b/graphics/java/android/graphics/RectF.java index 3361fa21e44b..1d294d51a235 100644 --- a/graphics/java/android/graphics/RectF.java +++ b/graphics/java/android/graphics/RectF.java @@ -27,7 +27,7 @@ import java.io.PrintWriter; /** * RectF holds four float coordinates for a rectangle. The rectangle is - * represented by the coordinates of its 4 edges (left, top, right bottom). + * represented by the coordinates of its 4 edges (left, top, right, bottom). * These fields can be accessed directly. Use width() and height() to retrieve * the rectangle's width and height. Note: most methods do not check to see that * the coordinates are sorted correctly (i.e. left <= right and top <= bottom). diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidProfile.java index 7f906f6c5b06..6d874ab2be9b 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/HidProfile.java @@ -117,7 +117,7 @@ public class HidProfile implements LocalBluetoothProfile { public boolean isPreferred(BluetoothDevice device) { if (mService == null) return false; - return mService.getPriority(device) > BluetoothProfile.PRIORITY_OFF; + return mService.getPriority(device) != BluetoothProfile.PRIORITY_OFF; } public int getPreferred(BluetoothDevice device) { diff --git a/packages/SettingsLib/src/com/android/settingslib/net/DataUsageUtils.java b/packages/SettingsLib/src/com/android/settingslib/net/DataUsageUtils.java index de38e8a366b4..b15ea980ae15 100644 --- a/packages/SettingsLib/src/com/android/settingslib/net/DataUsageUtils.java +++ b/packages/SettingsLib/src/com/android/settingslib/net/DataUsageUtils.java @@ -18,15 +18,11 @@ package com.android.settingslib.net; import android.content.Context; import android.net.NetworkTemplate; -import android.os.ParcelUuid; import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.util.Log; -import java.util.ArrayList; -import java.util.List; - /** * Utils class for data usage */ @@ -38,7 +34,7 @@ public class DataUsageUtils { */ public static NetworkTemplate getMobileTemplate(Context context, int subId) { final TelephonyManager telephonyManager = context.getSystemService( - TelephonyManager.class); + TelephonyManager.class).createForSubscriptionId(subId); final SubscriptionManager subscriptionManager = context.getSystemService( SubscriptionManager.class); final SubscriptionInfo info = subscriptionManager.getActiveSubscriptionInfo(subId); @@ -49,23 +45,8 @@ public class DataUsageUtils { Log.i(TAG, "Subscription is not active: " + subId); return mobileAll; } - final ParcelUuid groupUuid = info.getGroupUuid(); - if (groupUuid == null) { - Log.i(TAG, "Subscription doesn't have valid group uuid: " + subId); - return mobileAll; - } - // Otherwise merge other subscriberId to create new NetworkTemplate - final List<SubscriptionInfo> groupInfos = subscriptionManager.getSubscriptionsInGroup( - groupUuid); - final List<String> mergedSubscriberIds = new ArrayList<>(); - for (SubscriptionInfo subInfo : groupInfos) { - final String subscriberId = telephonyManager.getSubscriberId( - subInfo.getSubscriptionId()); - if (subscriberId != null) { - mergedSubscriberIds.add(subscriberId); - } - } - return NetworkTemplate.normalize(mobileAll, mergedSubscriberIds.toArray(new String[0])); + // Use old API to build networkTemplate + return NetworkTemplate.normalize(mobileAll, telephonyManager.getMergedSubscriberIds()); } } diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/net/DataUsageUtilsTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/net/DataUsageUtilsTest.java index dc33cfe4b2f8..821c0b3a23f7 100644 --- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/net/DataUsageUtilsTest.java +++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/net/DataUsageUtilsTest.java @@ -44,7 +44,6 @@ import java.util.List; public class DataUsageUtilsTest { private static final int SUB_ID = 1; - private static final int SUB_ID_2 = 2; private static final String SUBSCRIBER_ID = "Test Subscriber"; private static final String SUBSCRIBER_ID_2 = "Test Subscriber 2"; @@ -67,11 +66,11 @@ public class DataUsageUtilsTest { mContext = spy(RuntimeEnvironment.application); when(mContext.getSystemService(TelephonyManager.class)).thenReturn(mTelephonyManager); + when(mTelephonyManager.createForSubscriptionId(SUB_ID)).thenReturn(mTelephonyManager); when(mContext.getSystemService(SubscriptionManager.class)).thenReturn(mSubscriptionManager); when(mTelephonyManager.getSubscriberId(SUB_ID)).thenReturn(SUBSCRIBER_ID); - when(mTelephonyManager.getSubscriberId(SUB_ID_2)).thenReturn(SUBSCRIBER_ID_2); - when(mInfo1.getSubscriptionId()).thenReturn(SUB_ID); - when(mInfo2.getSubscriptionId()).thenReturn(SUB_ID_2); + when(mTelephonyManager.getMergedSubscriberIds()).thenReturn( + new String[]{SUBSCRIBER_ID, SUBSCRIBER_ID_2}); mInfos = new ArrayList<>(); mInfos.add(mInfo1); @@ -89,17 +88,7 @@ public class DataUsageUtilsTest { } @Test - public void getMobileTemplate_groupUuidNull_returnMobileAll() { - when(mSubscriptionManager.getActiveSubscriptionInfo(SUB_ID)).thenReturn(mInfo1); - when(mInfo1.getGroupUuid()).thenReturn(null); - - final NetworkTemplate networkTemplate = DataUsageUtils.getMobileTemplate(mContext, SUB_ID); - assertThat(networkTemplate.matchesSubscriberId(SUBSCRIBER_ID)).isTrue(); - assertThat(networkTemplate.matchesSubscriberId(SUBSCRIBER_ID_2)).isFalse(); - } - - @Test - public void getMobileTemplate_groupUuidExist_returnMobileMerged() { + public void getMobileTemplate_infoExisted_returnMobileMerged() { when(mSubscriptionManager.getActiveSubscriptionInfo(SUB_ID)).thenReturn(mInfo1); when(mInfo1.getGroupUuid()).thenReturn(mParcelUuid); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index 237825e44b97..f7b79d175263 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -88,6 +88,7 @@ import com.android.systemui.R; import com.android.systemui.SwipeHelper; import com.android.systemui.classifier.FalsingManagerFactory; import com.android.systemui.colorextraction.SysuiColorExtractor; +import com.android.systemui.doze.DozeLog; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin; @@ -506,6 +507,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd * If the {@link NotificationShelf} should be visible when dark. */ private boolean mAnimateBottomOnLayout; + private int mPulseReason; @Inject public NotificationStackScrollLayout( @@ -1355,7 +1357,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd mIsClipped = clipped; } - if (!mPulsing && mAmbientState.isFullyDark()) { + if ((!mPulsing || mPulseReason == DozeLog.PULSE_REASON_DOCKING) + && mAmbientState.isFullyDark()) { setClipBounds(null); } else if (mAmbientState.isDarkAtAll()) { clipToOutline = true; @@ -5179,6 +5182,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd notifyHeightChangeListener(null, animated); } + public void setPulseReason(int pulseReason) { + mPulseReason = pulseReason; + updateClipping(); + } + @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void setQsExpanded(boolean qsExpanded) { mQsExpanded = qsExpanded; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index bc205d676914..3665dcba0749 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -3134,6 +3134,10 @@ public class NotificationPanelView extends PanelView implements mAnimateNextPositionUpdate = true; } + public void setPulseReason(int reason) { + mNotificationStackScroller.setPulseReason(reason); + } + /** * Panel and QS expansion callbacks. */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index c6de829e49be..2c305dff3246 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -3928,6 +3928,7 @@ public class StatusBar extends SystemUI implements DemoMode, // execute the transition. The pulse callback will then be invoked when the scrims // are black, indicating that StatusBar is ready to present the rest of the UI. mPulsing = true; + mNotificationPanel.setPulseReason(reason); mDozeScrimController.pulse(new PulseCallback() { @Override public void onPulseStarted() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java index 01498e6bd54d..6fc265e6f983 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitor.java @@ -19,7 +19,6 @@ import com.android.systemui.statusbar.policy.KeyguardMonitor.Callback; public interface KeyguardMonitor extends CallbackController<Callback> { boolean isSecure(); - boolean canSkipBouncer(); boolean isShowing(); boolean isOccluded(); boolean isKeyguardFadingAway(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java index b53ff0e45cea..2b08d68f1072 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/KeyguardMonitorImpl.java @@ -17,13 +17,11 @@ package com.android.systemui.statusbar.policy; import android.annotation.NonNull; -import android.app.ActivityManager; import android.content.Context; import com.android.internal.util.Preconditions; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; -import com.android.systemui.settings.CurrentUserTracker; import java.util.ArrayList; @@ -39,14 +37,11 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback private final ArrayList<Callback> mCallbacks = new ArrayList<>(); private final Context mContext; - private final CurrentUserTracker mUserTracker; private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; - private int mCurrentUser; private boolean mShowing; private boolean mSecure; private boolean mOccluded; - private boolean mCanSkipBouncer; private boolean mListening; private boolean mKeyguardFadingAway; @@ -61,13 +56,6 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback public KeyguardMonitorImpl(Context context) { mContext = context; mKeyguardUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext); - mUserTracker = new CurrentUserTracker(mContext) { - @Override - public void onUserSwitched(int newUserId) { - mCurrentUser = newUserId; - updateCanSkipBouncerState(); - } - }; } @Override @@ -76,10 +64,7 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback mCallbacks.add(callback); if (mCallbacks.size() != 0 && !mListening) { mListening = true; - mCurrentUser = ActivityManager.getCurrentUser(); - updateCanSkipBouncerState(); mKeyguardUpdateMonitor.registerCallback(this); - mUserTracker.startTracking(); } } @@ -89,7 +74,6 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback if (mCallbacks.remove(callback) && mCallbacks.size() == 0 && mListening) { mListening = false; mKeyguardUpdateMonitor.removeCallback(this); - mUserTracker.stopTracking(); } } @@ -108,11 +92,6 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback return mOccluded; } - @Override - public boolean canSkipBouncer() { - return mCanSkipBouncer; - } - public void notifyKeyguardState(boolean showing, boolean secure, boolean occluded) { if (mShowing == showing && mSecure == secure && mOccluded == occluded) return; mShowing = showing; @@ -123,7 +102,6 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback @Override public void onTrustChanged(int userId) { - updateCanSkipBouncerState(); notifyKeyguardChanged(); } @@ -131,10 +109,6 @@ public class KeyguardMonitorImpl extends KeyguardUpdateMonitorCallback return mKeyguardUpdateMonitor.isDeviceInteractive(); } - private void updateCanSkipBouncerState() { - mCanSkipBouncer = mKeyguardUpdateMonitor.getUserCanSkipBouncer(mCurrentUser); - } - private void notifyKeyguardChanged() { // Copy the list to allow removal during callback. new ArrayList<>(mCallbacks).forEach(Callback::onKeyguardShowingChanged); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java index 395add76dda4..35e3923f285b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java @@ -61,6 +61,7 @@ import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.qs.DetailAdapter; import com.android.systemui.qs.tiles.UserDetailView; import com.android.systemui.statusbar.phone.SystemUIDialog; +import com.android.systemui.statusbar.phone.UnlockMethodCache; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -595,17 +596,19 @@ public class UserSwitcherController implements Dumpable { final UserSwitcherController mController; private final KeyguardMonitor mKeyguardMonitor; + private final UnlockMethodCache mUnlockMethodCache; protected BaseUserAdapter(UserSwitcherController controller) { mController = controller; mKeyguardMonitor = controller.mKeyguardMonitor; + mUnlockMethodCache = UnlockMethodCache.getInstance(controller.mContext); controller.addAdapter(new WeakReference<>(this)); } public int getUserCount() { boolean secureKeyguardShowing = mKeyguardMonitor.isShowing() && mKeyguardMonitor.isSecure() - && !mKeyguardMonitor.canSkipBouncer(); + && !mUnlockMethodCache.canSkipBouncer(); if (!secureKeyguardShowing) { return mController.getUsers().size(); } @@ -627,7 +630,7 @@ public class UserSwitcherController implements Dumpable { public int getCount() { boolean secureKeyguardShowing = mKeyguardMonitor.isShowing() && mKeyguardMonitor.isSecure() - && !mKeyguardMonitor.canSkipBouncer(); + && !mUnlockMethodCache.canSkipBouncer(); if (!secureKeyguardShowing) { return mController.getUsers().size(); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeKeyguardMonitor.java b/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeKeyguardMonitor.java index 95c7a4d09f92..2fb0e0e7caf8 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeKeyguardMonitor.java +++ b/packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeKeyguardMonitor.java @@ -80,9 +80,4 @@ public class FakeKeyguardMonitor implements KeyguardMonitor { public long calculateGoingToFullShadeDelay() { return 0; } - - @Override - public boolean canSkipBouncer() { - return false; - } } diff --git a/services/accessibility/TEST_MAPPING b/services/accessibility/TEST_MAPPING index 45c52452afb4..d90c3bd9b4c2 100644 --- a/services/accessibility/TEST_MAPPING +++ b/services/accessibility/TEST_MAPPING @@ -52,9 +52,6 @@ }, { "exclude-annotation": "androidx.test.filters.FlakyTest" - }, - { - "exclude-filter": "android.view.textclassifier.TextClassifierTest#testSuggetsConversationActions_deduplicate" } ] }, @@ -66,9 +63,6 @@ }, { "exclude-annotation": "androidx.test.filters.FlakyTest" - }, - { - "exclude-filter": "android.view.textclassifier.TextClassifierTest#testSuggetsConversationActions_deduplicate" } ] } diff --git a/services/core/java/com/android/server/GraphicsStatsService.java b/services/core/java/com/android/server/GraphicsStatsService.java index 70569db5e2d3..4639d7586f83 100644 --- a/services/core/java/com/android/server/GraphicsStatsService.java +++ b/services/core/java/com/android/server/GraphicsStatsService.java @@ -191,7 +191,7 @@ public class GraphicsStatsService extends IGraphicsStats.Stub { if (!file.getFileDescriptor().valid()) { throw new IllegalStateException("Invalid file descriptor"); } - return ParcelFileDescriptor.dup(file.getFileDescriptor()); + return new ParcelFileDescriptor(file.getFileDescriptor()); } catch (IOException ex) { throw new IllegalStateException("Failed to get PFD from memory file", ex); } diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index e462c7d82c74..f97e20cd298d 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -5267,7 +5267,7 @@ public class ActivityManagerService extends IActivityManager.Stub storageManager.commitChanges(); } catch (Exception e) { PowerManager pm = (PowerManager) - mInjector.getContext().getSystemService(Context.POWER_SERVICE); + mContext.getSystemService(Context.POWER_SERVICE); pm.reboot("Checkpoint commit failed"); } diff --git a/services/core/java/com/android/server/am/TEST_MAPPING b/services/core/java/com/android/server/am/TEST_MAPPING index 2c2013c89bab..21d4925722d0 100644 --- a/services/core/java/com/android/server/am/TEST_MAPPING +++ b/services/core/java/com/android/server/am/TEST_MAPPING @@ -14,18 +14,6 @@ }, { "exclude-annotation": "androidx.test.filters.FlakyTest" - }, - { - "exclude-filter": "android.app.cts.AlarmManagerTest#testSetRepeating" - }, - { - "exclude-filter": "android.app.cts.ServiceTest#testAppZygoteServices" - }, - { - "exclude-filter": "android.app.cts.SystemFeaturesTest#testLocationFeatures" - }, - { - "exclude-filter": "android.app.cts.SystemFeaturesTest#testSensorFeatures" } ] }, diff --git a/services/core/java/com/android/server/pm/PackageInstallerService.java b/services/core/java/com/android/server/pm/PackageInstallerService.java index 0032e9a8ea51..e75f545eafaa 100644 --- a/services/core/java/com/android/server/pm/PackageInstallerService.java +++ b/services/core/java/com/android/server/pm/PackageInstallerService.java @@ -505,6 +505,11 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements params.installFlags &= ~PackageManager.INSTALL_REQUEST_DOWNGRADE; } + if (callingUid != Process.SYSTEM_UID) { + // Only system_server can use INSTALL_DISABLE_VERIFICATION. + params.installFlags &= ~PackageManager.INSTALL_DISABLE_VERIFICATION; + } + boolean isApex = (params.installFlags & PackageManager.INSTALL_APEX) != 0; if (params.isStaged || isApex) { mContext.enforceCallingOrSelfPermission(Manifest.permission.INSTALL_PACKAGES, TAG); diff --git a/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java b/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java index e107c9aedf38..08c1bb536211 100644 --- a/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java +++ b/services/core/java/com/android/server/rollback/RollbackManagerServiceImpl.java @@ -86,9 +86,9 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { private static final String TAG = "RollbackManager"; - // Rollbacks expire after 48 hours. + // Rollbacks expire after 14 days. private static final long DEFAULT_ROLLBACK_LIFETIME_DURATION_MILLIS = - TimeUnit.HOURS.toMillis(48); + TimeUnit.DAYS.toMillis(14); // Lock used to synchronize accesses to in-memory rollback data // structures. By convention, methods with the suffix "Locked" require @@ -1289,7 +1289,8 @@ class RollbackManagerServiceImpl extends IRollbackManager.Stub { private boolean packageVersionsEqual(VersionedPackage a, VersionedPackage b) { - return a.getPackageName().equals(b.getPackageName()) + return a != null && b != null + && a.getPackageName().equals(b.getPackageName()) && a.getLongVersionCode() == b.getLongVersionCode(); } diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java index 9908b3657121..b0f1e5d69be4 100644 --- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java @@ -1172,8 +1172,16 @@ public class WallpaperManagerService extends IWallpaperManager.Stub return false; } final int displayId = display.getDisplayId(); - return displayId == DEFAULT_DISPLAY - || mWindowManagerInternal.shouldShowSystemDecorOnDisplay(displayId); + if (displayId == DEFAULT_DISPLAY) { + return true; + } + + final long ident = Binder.clearCallingIdentity(); + try { + return mWindowManagerInternal.shouldShowSystemDecorOnDisplay(displayId); + } finally { + Binder.restoreCallingIdentity(ident); + } } void forEachDisplayConnector(Consumer<DisplayConnector> action) { diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 5c1dfef925cd..e6ed2edba807 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -38,6 +38,7 @@ import android.database.sqlite.SQLiteCompatibilityWalFlags; import android.database.sqlite.SQLiteGlobal; import android.hardware.display.DisplayManagerInternal; import android.net.ConnectivityModuleConnector; +import android.net.Network; import android.net.NetworkStackClient; import android.os.BaseBundle; import android.os.Binder; diff --git a/services/net/java/android/net/ConnectivityModuleConnector.java b/services/net/java/android/net/ConnectivityModuleConnector.java index 19ade3394de7..62f2c35f339b 100644 --- a/services/net/java/android/net/ConnectivityModuleConnector.java +++ b/services/net/java/android/net/ConnectivityModuleConnector.java @@ -32,7 +32,7 @@ import android.os.IBinder; import android.os.Process; import android.os.SystemClock; import android.os.UserHandle; -import android.provider.Settings; +import android.provider.DeviceConfig; import android.text.format.DateUtils; import android.util.ArraySet; import android.util.Slog; @@ -296,8 +296,6 @@ public class ConnectivityModuleConnector { private synchronized void maybeCrashWithTerribleFailure(@NonNull String message, @Nullable String packageName) { logWtf(message, null); - // Called DeviceConfig to minimize merge conflicts - final DeviceConfigStub DeviceConfig = new DeviceConfigStub(mContext); // uptime is monotonic even after a framework restart final long uptime = SystemClock.elapsedRealtime(); final long now = System.currentTimeMillis(); @@ -417,36 +415,4 @@ public class ConnectivityModuleConnector { // dump is thread-safe on SharedLog mLog.dump(null, pw, null); } - - /** - * Stub class to replicate DeviceConfig behavior with minimal merge conflicts. - */ - private class DeviceConfigStub { - private final Context mContext; - - // Namespace is actually unused, but is here to replicate the final API. - private static final String NAMESPACE_CONNECTIVITY = "connectivity"; - - private DeviceConfigStub(Context context) { - mContext = context; - } - - private long getLong( - @NonNull String namespace, @NonNull String key, long defaultVal) { - // Temporary solution until DeviceConfig is available - try { - return Settings.Global.getLong( - mContext.getContentResolver(), TAG + "_" + key, defaultVal); - } catch (Throwable e) { - logWtf("Could not obtain setting " + key, e); - return defaultVal; - } - } - - private boolean getBoolean( - @NonNull String namespace, @NonNull String key, boolean defaultVal) { - // Temporary solution until DeviceConfig is available - return getLong(namespace, key, defaultVal ? 1 : 0) != 0; - } - } } diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pManager.java b/wifi/java/android/net/wifi/p2p/WifiP2pManager.java index cd659e2a934a..d37c4a2e78db 100644 --- a/wifi/java/android/net/wifi/p2p/WifiP2pManager.java +++ b/wifi/java/android/net/wifi/p2p/WifiP2pManager.java @@ -190,7 +190,7 @@ public class WifiP2pManager { * has changed. One extra {@link #EXTRA_WIFI_P2P_INFO} provides the p2p connection info in * the form of a {@link WifiP2pInfo} object. Another extra {@link #EXTRA_NETWORK_INFO} provides * the network info in the form of a {@link android.net.NetworkInfo}. A third extra provides - * the details of the group. + * the details of the group and may contain a {@code null}. * * All of these permissions are required to receive this broadcast: * {@link android.Manifest.permission#ACCESS_FINE_LOCATION} and |