diff options
52 files changed, 575 insertions, 187 deletions
diff --git a/api/current.txt b/api/current.txt index 08332efb72ed..2a263681d624 100644 --- a/api/current.txt +++ b/api/current.txt @@ -53047,6 +53047,16 @@ package android.view.autofill { package android.view.contentcapture { + public final class ContentCaptureCondition implements android.os.Parcelable { + ctor public ContentCaptureCondition(@NonNull android.content.LocusId, int); + method public int describeContents(); + method public int getFlags(); + method @NonNull public android.content.LocusId getLocusId(); + method public void writeToParcel(@NonNull android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.view.contentcapture.ContentCaptureCondition> CREATOR; + field public static final int FLAG_IS_REGEX = 2; // 0x2 + } + public final class ContentCaptureContext implements android.os.Parcelable { method public int describeContents(); method @NonNull public static android.view.contentcapture.ContentCaptureContext forLocusId(@NonNull String); @@ -53063,6 +53073,7 @@ package android.view.contentcapture { } public final class ContentCaptureManager { + method @Nullable public java.util.Set<android.view.contentcapture.ContentCaptureCondition> getContentCaptureConditions(); method @Nullable public android.content.ComponentName getServiceComponentName(); method public boolean isContentCaptureEnabled(); method public void removeUserData(@NonNull android.view.contentcapture.UserDataRemovalRequest); diff --git a/api/system-current.txt b/api/system-current.txt index 5e1d63f5957f..23cecf4890b5 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -6448,6 +6448,7 @@ package android.service.contentcapture { method public void onDestroyContentCaptureSession(@NonNull android.view.contentcapture.ContentCaptureSessionId); method public void onDisconnected(); method public void onUserDataRemovalRequest(@NonNull android.view.contentcapture.UserDataRemovalRequest); + method public final void setContentCaptureConditions(@NonNull String, @Nullable java.util.Set<android.view.contentcapture.ContentCaptureCondition>); method public final void setContentCaptureWhitelist(@Nullable java.util.Set<java.lang.String>, @Nullable java.util.Set<android.content.ComponentName>); field public static final String SERVICE_INTERFACE = "android.service.contentcapture.ContentCaptureService"; field public static final String SERVICE_META_DATA = "android.content_capture"; diff --git a/api/test-current.txt b/api/test-current.txt index 9817a9747ff7..6c0b92853673 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -2457,6 +2457,7 @@ package android.service.contentcapture { method public void onDestroyContentCaptureSession(@NonNull android.view.contentcapture.ContentCaptureSessionId); method public void onDisconnected(); method public void onUserDataRemovalRequest(@NonNull android.view.contentcapture.UserDataRemovalRequest); + method public final void setContentCaptureConditions(@NonNull String, @Nullable java.util.Set<android.view.contentcapture.ContentCaptureCondition>); method public final void setContentCaptureWhitelist(@Nullable java.util.Set<java.lang.String>, @Nullable java.util.Set<android.content.ComponentName>); field public static final String SERVICE_INTERFACE = "android.service.contentcapture.ContentCaptureService"; field public static final String SERVICE_META_DATA = "android.content_capture"; diff --git a/core/java/android/app/role/RoleControllerManager.java b/core/java/android/app/role/RoleControllerManager.java index e96c9a541c3f..bd981179e2ff 100644 --- a/core/java/android/app/role/RoleControllerManager.java +++ b/core/java/android/app/role/RoleControllerManager.java @@ -167,7 +167,7 @@ public class RoleControllerManager { RemoteService(@NonNull Context context, @NonNull ComponentName componentName, @NonNull Handler handler, @UserIdInt int userId) { super(context, RoleControllerService.SERVICE_INTERFACE, componentName, userId, - service -> Log.e(LOG_TAG, "RemoteService " + service + " died"), handler, false, + service -> Log.e(LOG_TAG, "RemoteService " + service + " died"), handler, 0, false, 1); } diff --git a/core/java/android/hardware/display/AmbientDisplayConfiguration.java b/core/java/android/hardware/display/AmbientDisplayConfiguration.java index b122f199bc6f..c45b8ed52187 100644 --- a/core/java/android/hardware/display/AmbientDisplayConfiguration.java +++ b/core/java/android/hardware/display/AmbientDisplayConfiguration.java @@ -48,7 +48,10 @@ public class AmbientDisplayConfiguration { return pulseOnNotificationEnabled(user) || pulseOnLongPressEnabled(user) || alwaysOnEnabled(user) - || wakeScreenGestureEnabled(user); + || wakeScreenGestureEnabled(user) + || pickupGestureEnabled(user) + || tapGestureEnabled(user) + || doubleTapGestureEnabled(user); } /** {@hide} */ diff --git a/core/java/android/permission/PermissionControllerManager.java b/core/java/android/permission/PermissionControllerManager.java index 61511aa509b1..55fae3014666 100644 --- a/core/java/android/permission/PermissionControllerManager.java +++ b/core/java/android/permission/PermissionControllerManager.java @@ -472,7 +472,7 @@ public final class PermissionControllerManager { @NonNull UserHandle user) { super(context, SERVICE_INTERFACE, componentName, user.getIdentifier(), service -> Log.e(TAG, "RemoteService " + service + " died"), - context.getMainThreadHandler(), false, false, 1); + context.getMainThreadHandler(), 0, false, 1); } /** diff --git a/core/java/android/preference/SeekBarVolumizer.java b/core/java/android/preference/SeekBarVolumizer.java index 01514646637e..9085fa2f0f5e 100644 --- a/core/java/android/preference/SeekBarVolumizer.java +++ b/core/java/android/preference/SeekBarVolumizer.java @@ -111,7 +111,7 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba @UnsupportedAppUsage public SeekBarVolumizer(Context context, int streamType, Uri defaultUri, Callback callback) { - this(context, streamType, defaultUri, callback, false /* playSample */); + this(context, streamType, defaultUri, callback, true /* playSample */); } public SeekBarVolumizer( diff --git a/core/java/android/service/contentcapture/ContentCaptureService.java b/core/java/android/service/contentcapture/ContentCaptureService.java index fb07abaa34a1..7a35b9e8fa74 100644 --- a/core/java/android/service/contentcapture/ContentCaptureService.java +++ b/core/java/android/service/contentcapture/ContentCaptureService.java @@ -39,6 +39,7 @@ import android.service.autofill.AutofillService; import android.util.ArrayMap; import android.util.Log; import android.util.Slog; +import android.view.contentcapture.ContentCaptureCondition; import android.view.contentcapture.ContentCaptureContext; import android.view.contentcapture.ContentCaptureEvent; import android.view.contentcapture.ContentCaptureManager; @@ -216,6 +217,32 @@ public abstract class ContentCaptureService extends Service { } } + /** + * Explicitly sets the conditions for which content capture should be available by an app. + * + * <p>Typically used to restrict content capture to a few websites on browser apps. Example: + * + * <code> + * ArraySet<ContentCaptureCondition> conditions = new ArraySet<>(1); + * conditions.add(new ContentCaptureCondition(new LocusId("^https://.*\\.example\\.com$"), + * ContentCaptureCondition.FLAG_IS_REGEX)); + * service.setContentCaptureConditions("com.example.browser_app", conditions); + * + * </code> + * + * <p>NOTE: </p> this method doesn't automatically disable content capture for the given + * conditions; it's up to the {@code packageName} implementation to call + * {@link ContentCaptureManager#getContentCaptureConditions()} and disable it accordingly. + * + * @param packageName name of the packages where the restrictions are set. + * @param conditions list of conditions, or {@code null} to reset the conditions for the + * package. + */ + public final void setContentCaptureConditions(@NonNull String packageName, + @Nullable Set<ContentCaptureCondition> conditions) { + // TODO(b/129267994): implement + } + private <T> ArrayList<T> toList(@Nullable Set<T> set) { return set == null ? null : new ArrayList<T>(set); } diff --git a/core/java/android/view/contentcapture/ContentCaptureCondition.java b/core/java/android/view/contentcapture/ContentCaptureCondition.java new file mode 100644 index 000000000000..ed872578d069 --- /dev/null +++ b/core/java/android/view/contentcapture/ContentCaptureCondition.java @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.view.contentcapture; + +import android.annotation.IntDef; +import android.annotation.NonNull; +import android.content.LocusId; +import android.os.Parcel; +import android.os.Parcelable; + +import com.android.internal.util.Preconditions; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +/** + * Defines a condition for when content capture should be allowed. + * + * <p>See {@link ContentCaptureManager#getContentCaptureConditions()} for more. + */ +public final class ContentCaptureCondition implements Parcelable { + + /** + * When set, package should use the {@link LocusId#getId()} as a regular expression. + */ + public static final int FLAG_IS_REGEX = 0x2; + + /** @hide */ + @IntDef(prefix = { "FLAG" }, flag = true, value = { + FLAG_IS_REGEX + }) + @Retention(RetentionPolicy.SOURCE) + @interface Flags {} + + private final @NonNull LocusId mLocusId; + private final @Flags int mFlags; + + /** + * Default constructor. + * + * @param locusId id of the condition, as defined by + * {@link ContentCaptureContext#getLocusId()}. + * @param flags either {@link ContentCaptureCondition#FLAG_IS_REGEX} or {@code 0}. + */ + public ContentCaptureCondition(@NonNull LocusId locusId, @Flags int flags) { + this.mLocusId = Preconditions.checkNotNull(locusId); + this.mFlags = flags; + // TODO(b/129267994): check flags, add test case for null and invalid flags + } + + /** + * Gets the {@code LocusId} per se. + */ + @NonNull + public LocusId getLocusId() { + return mLocusId; + } + + /** + * Gets the flags associates with this condition. + * + * @return either {@link ContentCaptureCondition#FLAG_IS_REGEX} or {@code 0}. + */ + public @Flags int getFlags() { + return mFlags; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(@NonNull Parcel parcel, int flags) { + parcel.writeParcelable(mLocusId, flags); + parcel.writeInt(mFlags); + } + + public static final @NonNull Parcelable.Creator<ContentCaptureCondition> CREATOR = + new Parcelable.Creator<ContentCaptureCondition>() { + + @Override + public ContentCaptureCondition createFromParcel(@NonNull Parcel parcel) { + return new ContentCaptureCondition(parcel.readParcelable(null), + parcel.readInt()); + } + + @Override + public ContentCaptureCondition[] newArray(int size) { + return new ContentCaptureCondition[size]; + } + }; +} diff --git a/core/java/android/view/contentcapture/ContentCaptureManager.java b/core/java/android/view/contentcapture/ContentCaptureManager.java index 9e546a80dfd3..817b13011402 100644 --- a/core/java/android/view/contentcapture/ContentCaptureManager.java +++ b/core/java/android/view/contentcapture/ContentCaptureManager.java @@ -43,6 +43,7 @@ import com.android.internal.util.SyncResultReceiver; import java.io.PrintWriter; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.util.Set; /** * TODO(b/123577059): add javadocs / mention it can be null @@ -362,6 +363,20 @@ public final class ContentCaptureManager { } /** + * Gets the list of conditions for when content capture should be allowed. + * + * <p>This method is typically used by web browsers so they don't generate unnecessary content + * capture events for websites the content capture service is not interested on. + * + * @return list of conditions, or {@code null} if the service didn't set any restriction + * (in which case content capture events should always be generated). + */ + @Nullable + public Set<ContentCaptureCondition> getContentCaptureConditions() { + return null; // TODO(b/129267994): implement + } + + /** * Called by apps to explicitly enable or disable content capture. * * <p><b>Note: </b> this call is not persisted accross reboots, so apps should typically call diff --git a/core/java/com/android/internal/app/AbstractResolverComparator.java b/core/java/com/android/internal/app/AbstractResolverComparator.java index 3576b6bb4236..e091aac04c60 100644 --- a/core/java/com/android/internal/app/AbstractResolverComparator.java +++ b/core/java/com/android/internal/app/AbstractResolverComparator.java @@ -1,7 +1,15 @@ package com.android.internal.app; +import android.app.usage.UsageStatsManager; import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; +import android.os.UserHandle; +import android.util.Log; import com.android.internal.app.ResolverActivity.ResolvedComponentInfo; +import java.util.ArrayList; import java.util.Comparator; import java.util.List; @@ -10,20 +18,102 @@ import java.util.List; */ abstract class AbstractResolverComparator implements Comparator<ResolvedComponentInfo> { + private static final int NUM_OF_TOP_ANNOTATIONS_TO_USE = 3; + protected AfterCompute mAfterCompute; + protected final PackageManager mPm; + protected final UsageStatsManager mUsm; + protected String[] mAnnotations; + protected String mContentType; + + // True if the current share is a link. + private final boolean mHttp; + // can be null if mHttp == false or current user has no default browser package + private final String mDefaultBrowserPackageName; + + AbstractResolverComparator(Context context, Intent intent) { + String scheme = intent.getScheme(); + mHttp = "http".equals(scheme) || "https".equals(scheme); + mContentType = intent.getType(); + getContentAnnotations(intent); + + mPm = context.getPackageManager(); + mUsm = (UsageStatsManager) context.getSystemService(Context.USAGE_STATS_SERVICE); + mDefaultBrowserPackageName = mHttp + ? mPm.getDefaultBrowserPackageNameAsUser(UserHandle.myUserId()) + : null; + } + + // get annotations of content from intent. + private void getContentAnnotations(Intent intent) { + ArrayList<String> annotations = intent.getStringArrayListExtra( + Intent.EXTRA_CONTENT_ANNOTATIONS); + if (annotations != null) { + int size = annotations.size(); + if (size > NUM_OF_TOP_ANNOTATIONS_TO_USE) { + size = NUM_OF_TOP_ANNOTATIONS_TO_USE; + } + mAnnotations = new String[size]; + for (int i = 0; i < size; i++) { + mAnnotations[i] = annotations.get(i); + } + } + } /** * Callback to be called when {@link #compute(List)} finishes. This signals to stop waiting. */ - public interface AfterCompute { + interface AfterCompute { - public void afterCompute(); + void afterCompute(); } - public void setCallBack(AfterCompute afterCompute) { + void setCallBack(AfterCompute afterCompute) { mAfterCompute = afterCompute; } + @Override + public final int compare(ResolvedComponentInfo lhsp, ResolvedComponentInfo rhsp) { + final ResolveInfo lhs = lhsp.getResolveInfoAt(0); + final ResolveInfo rhs = rhsp.getResolveInfoAt(0); + + // We want to put the one targeted to another user at the end of the dialog. + if (lhs.targetUserId != UserHandle.USER_CURRENT) { + return rhs.targetUserId != UserHandle.USER_CURRENT ? 0 : 1; + } + if (rhs.targetUserId != UserHandle.USER_CURRENT) { + return -1; + } + + if (mHttp) { + // Special case: we want filters that match URI paths/schemes to be + // ordered before others. This is for the case when opening URIs, + // to make native apps go above browsers - except for 1 even more special case + // which is the default browser, as we want that to go above them all. + if (isDefaultBrowser(lhs)) { + return -1; + } + + if (isDefaultBrowser(rhs)) { + return 1; + } + final boolean lhsSpecific = ResolverActivity.isSpecificUriMatch(lhs.match); + final boolean rhsSpecific = ResolverActivity.isSpecificUriMatch(rhs.match); + if (lhsSpecific != rhsSpecific) { + return lhsSpecific ? -1 : 1; + } + } + return compare(lhs, rhs); + } + + /** + * Delegated to when used as a {@link Comparator<ResolvedComponentInfo>} if there is not a + * special case. The {@link ResolveInfo ResolveInfos} are the first {@link ResolveInfo} in + * {@link ResolvedComponentInfo#getResolveInfoAt(int)} from the parameters of {@link + * #compare(ResolvedComponentInfo, ResolvedComponentInfo)} + */ + abstract int compare(ResolveInfo lhs, ResolveInfo rhs); + /** * Computes features for each target. This will be called before calls to {@link * #getScore(ComponentName)} or {@link #compare(Object, Object)}, in order to prepare the @@ -31,19 +121,22 @@ abstract class AbstractResolverComparator implements Comparator<ResolvedComponen * ComponentName}, so the implementation will have to be prepared to identify a {@link * ResolvedComponentInfo} by {@link ComponentName}. */ - public abstract void compute(List<ResolvedComponentInfo> targets); + abstract void compute(List<ResolvedComponentInfo> targets); /** * Returns the score that was calculated for the corresponding {@link ResolvedComponentInfo} * when {@link #compute(List)} was called before this. */ - public abstract float getScore(ComponentName name); + abstract float getScore(ComponentName name); /** * Reports to UsageStats what was chosen. */ - // TODO(b/129014961) Move implemetation here and make final. - public abstract void updateChooserCounts(String packageName, int userId, String action); + final void updateChooserCounts(String packageName, int userId, String action) { + if (mUsm != null) { + mUsm.reportChooserSelection(packageName, userId, mContentType, mAnnotations, action); + } + } /** * Updates the model used to rank the componentNames. @@ -53,11 +146,25 @@ abstract class AbstractResolverComparator implements Comparator<ResolvedComponen * * @param componentName the component that the user clicked */ - public void updateModel(ComponentName componentName) { + void updateModel(ComponentName componentName) { } /** * Called when the {@link ResolverActivity} is destroyed. */ - public abstract void destroy(); + abstract void destroy(); + + private boolean isDefaultBrowser(ResolveInfo ri) { + // It makes sense to prefer the default browser + // only if the targeted user is the current user + if (ri.targetUserId != UserHandle.USER_CURRENT) { + return false; + } + + if (ri.activityInfo.packageName != null + && ri.activityInfo.packageName.equals(mDefaultBrowserPackageName)) { + return true; + } + return false; + } } diff --git a/core/java/com/android/internal/app/ResolverRankerServiceResolverComparator.java b/core/java/com/android/internal/app/ResolverRankerServiceResolverComparator.java index a88a80f199a4..9bf4f01bab06 100644 --- a/core/java/com/android/internal/app/ResolverRankerServiceResolverComparator.java +++ b/core/java/com/android/internal/app/ResolverRankerServiceResolverComparator.java @@ -60,8 +60,6 @@ class ResolverRankerServiceResolverComparator extends AbstractResolverComparator private static final boolean DEBUG = false; - private static final int NUM_OF_TOP_ANNOTATIONS_TO_USE = 3; - // One week private static final long USAGE_STATS_PERIOD = 1000 * 60 * 60 * 24 * 7; @@ -80,11 +78,6 @@ class ResolverRankerServiceResolverComparator extends AbstractResolverComparator private static final int WATCHDOG_TIMEOUT_MILLIS = 500; private final Collator mCollator; - private final boolean mHttp; - // can be null if mHttp == false or current user has no default browser package - private final String mDefaultBrowserPackageName; - private final PackageManager mPm; - private final UsageStatsManager mUsm; private final Map<String, UsageStats> mStats; private final long mCurrentTime; private final long mSinceTime; @@ -92,8 +85,6 @@ class ResolverRankerServiceResolverComparator extends AbstractResolverComparator private final String mReferrerPackage; private final Object mLock = new Object(); private ArrayList<ResolverTarget> mTargets; - private String mContentType; - private String[] mAnnotations; private String mAction; private ComponentName mResolvedRankerName; private ComponentName mRankerServiceName; @@ -155,43 +146,17 @@ class ResolverRankerServiceResolverComparator extends AbstractResolverComparator public ResolverRankerServiceResolverComparator(Context context, Intent intent, String referrerPackage, AfterCompute afterCompute) { + super(context, intent); mCollator = Collator.getInstance(context.getResources().getConfiguration().locale); - String scheme = intent.getScheme(); - mHttp = "http".equals(scheme) || "https".equals(scheme); mReferrerPackage = referrerPackage; mAfterCompute = afterCompute; mContext = context; - mPm = context.getPackageManager(); - mUsm = (UsageStatsManager) context.getSystemService(Context.USAGE_STATS_SERVICE); - mCurrentTime = System.currentTimeMillis(); mSinceTime = mCurrentTime - USAGE_STATS_PERIOD; mStats = mUsm.queryAndAggregateUsageStats(mSinceTime, mCurrentTime); - mContentType = intent.getType(); - getContentAnnotations(intent); mAction = intent.getAction(); mRankerServiceName = new ComponentName(mContext, this.getClass()); - - mDefaultBrowserPackageName = mHttp - ? mPm.getDefaultBrowserPackageNameAsUser(UserHandle.myUserId()) - : null; - } - - // get annotations of content from intent. - private void getContentAnnotations(Intent intent) { - ArrayList<String> annotations = intent.getStringArrayListExtra( - Intent.EXTRA_CONTENT_ANNOTATIONS); - if (annotations != null) { - int size = annotations.size(); - if (size > NUM_OF_TOP_ANNOTATIONS_TO_USE) { - size = NUM_OF_TOP_ANNOTATIONS_TO_USE; - } - mAnnotations = new String[size]; - for (int i = 0; i < size; i++) { - mAnnotations[i] = annotations.get(i); - } - } } // compute features for each target according to usage stats of targets. @@ -286,36 +251,7 @@ class ResolverRankerServiceResolverComparator extends AbstractResolverComparator } @Override - public int compare(ResolvedComponentInfo lhsp, ResolvedComponentInfo rhsp) { - final ResolveInfo lhs = lhsp.getResolveInfoAt(0); - final ResolveInfo rhs = rhsp.getResolveInfoAt(0); - - // We want to put the one targeted to another user at the end of the dialog. - if (lhs.targetUserId != UserHandle.USER_CURRENT) { - return rhs.targetUserId != UserHandle.USER_CURRENT ? 0 : 1; - } - if (rhs.targetUserId != UserHandle.USER_CURRENT) { - return -1; - } - - if (mHttp) { - // Special case: we want filters that match URI paths/schemes to be - // ordered before others. This is for the case when opening URIs, - // to make native apps go above browsers - except for 1 even more special case - // which is the default browser, as we want that to go above them all. - if (isDefaultBrowser(lhs)) { - return -1; - } - if (isDefaultBrowser(rhs)) { - return 1; - } - final boolean lhsSpecific = ResolverActivity.isSpecificUriMatch(lhs.match); - final boolean rhsSpecific = ResolverActivity.isSpecificUriMatch(rhs.match); - if (lhsSpecific != rhsSpecific) { - return lhsSpecific ? -1 : 1; - } - } - + public int compare(ResolveInfo lhs, ResolveInfo rhs) { if (mStats != null) { final ResolverTarget lhsTarget = mTargetsDict.get(new ComponentName( lhs.activityInfo.packageName, lhs.activityInfo.name)); @@ -349,13 +285,6 @@ class ResolverRankerServiceResolverComparator extends AbstractResolverComparator return 0; } - @Override - public void updateChooserCounts(String packageName, int userId, String action) { - if (mUsm != null) { - mUsm.reportChooserSelection(packageName, userId, mContentType, mAnnotations, action); - } - } - // update ranking model when the connection to it is valid. @Override public void updateModel(ComponentName componentName) { @@ -407,20 +336,6 @@ class ResolverRankerServiceResolverComparator extends AbstractResolverComparator } } - private boolean isDefaultBrowser(ResolveInfo ri) { - // It makes sense to prefer the default browser - // only if the targeted user is the current user - if (ri.targetUserId != UserHandle.USER_CURRENT) { - return false; - } - - if (ri.activityInfo.packageName != null - && ri.activityInfo.packageName.equals(mDefaultBrowserPackageName)) { - return true; - } - return false; - } - // records metrics for evaluation. private void logMetrics(int selectedPos) { if (mRankerServiceName != null) { diff --git a/core/java/com/android/internal/infra/AbstractMultiplePendingRequestsRemoteService.java b/core/java/com/android/internal/infra/AbstractMultiplePendingRequestsRemoteService.java index 37f61bf650c7..206efa94b7f6 100644 --- a/core/java/com/android/internal/infra/AbstractMultiplePendingRequestsRemoteService.java +++ b/core/java/com/android/internal/infra/AbstractMultiplePendingRequestsRemoteService.java @@ -45,9 +45,9 @@ public abstract class AbstractMultiplePendingRequestsRemoteService<S public AbstractMultiplePendingRequestsRemoteService(@NonNull Context context, @NonNull String serviceInterface, @NonNull ComponentName componentName, int userId, @NonNull VultureCallback<S> callback, @NonNull Handler handler, - boolean bindInstantServiceAllowed, boolean verbose, int initialCapacity) { - super(context, serviceInterface, componentName, userId, callback, handler, - bindInstantServiceAllowed, verbose); + int bindingFlags, boolean verbose, int initialCapacity) { + super(context, serviceInterface, componentName, userId, callback, handler, bindingFlags, + verbose); mInitialCapacity = initialCapacity; } diff --git a/core/java/com/android/internal/infra/AbstractRemoteService.java b/core/java/com/android/internal/infra/AbstractRemoteService.java index 0a83fcc6db61..1155854efd55 100644 --- a/core/java/com/android/internal/infra/AbstractRemoteService.java +++ b/core/java/com/android/internal/infra/AbstractRemoteService.java @@ -82,7 +82,7 @@ public abstract class AbstractRemoteService<S extends AbstractRemoteService<S, I private final VultureCallback<S> mVultureCallback; private final int mUserId; private final ServiceConnection mServiceConnection = new RemoteServiceConnection(); - private final boolean mBindInstantServiceAllowed; + private final int mBindingFlags; protected I mService; private boolean mBinding; @@ -113,7 +113,7 @@ public abstract class AbstractRemoteService<S extends AbstractRemoteService<S, I // NOTE: must be package-protected so this class is not extended outside AbstractRemoteService(@NonNull Context context, @NonNull String serviceInterface, @NonNull ComponentName componentName, int userId, @NonNull VultureCallback<S> callback, - @NonNull Handler handler, boolean bindInstantServiceAllowed, boolean verbose) { + @NonNull Handler handler, int bindingFlags, boolean verbose) { mContext = context; mVultureCallback = callback; mVerbose = verbose; @@ -121,7 +121,7 @@ public abstract class AbstractRemoteService<S extends AbstractRemoteService<S, I mIntent = new Intent(serviceInterface).setComponent(mComponentName); mUserId = userId; mHandler = new Handler(handler.getLooper()); - mBindInstantServiceAllowed = bindInstantServiceAllowed; + mBindingFlags = bindingFlags; } /** @@ -264,7 +264,7 @@ public abstract class AbstractRemoteService<S extends AbstractRemoteService<S, I } } pw.println(); - pw.append(prefix).append("mBindInstantServiceAllowed=").println(mBindInstantServiceAllowed); + pw.append(prefix).append("mBindingFlags=").println(mBindingFlags); pw.append(prefix).append("idleTimeout=") .append(Long.toString(idleTimeout / 1000)).append("s\n"); pw.append(prefix).append("requestTimeout="); @@ -407,10 +407,8 @@ public abstract class AbstractRemoteService<S extends AbstractRemoteService<S, I if (mVerbose) Slog.v(mTag, "ensureBound()"); mBinding = true; - int flags = Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE; - if (mBindInstantServiceAllowed) { - flags |= Context.BIND_ALLOW_INSTANT; - } + final int flags = Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE + | mBindingFlags; final boolean willBind = mContext.bindServiceAsUser(mIntent, mServiceConnection, flags, mHandler, new UserHandle(mUserId)); diff --git a/core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java b/core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java index a70fc3e17d60..66bee95b0302 100644 --- a/core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java +++ b/core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java @@ -44,9 +44,9 @@ public abstract class AbstractSinglePendingRequestRemoteService<S public AbstractSinglePendingRequestRemoteService(@NonNull Context context, @NonNull String serviceInterface, @NonNull ComponentName componentName, int userId, @NonNull VultureCallback<S> callback, @NonNull Handler handler, - boolean bindInstantServiceAllowed, boolean verbose) { - super(context, serviceInterface, componentName, userId, callback, handler, - bindInstantServiceAllowed, verbose); + int bindingFlags, boolean verbose) { + super(context, serviceInterface, componentName, userId, callback, handler, bindingFlags, + verbose); } @Override // from AbstractRemoteService diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java index 992ddd8f1525..18351196518e 100644 --- a/core/java/com/android/internal/os/Zygote.java +++ b/core/java/com/android/internal/os/Zygote.java @@ -514,6 +514,7 @@ public final class Zygote { private static Runnable usapMain(LocalServerSocket usapPoolSocket, FileDescriptor writePipe) { final int pid = Process.myPid(); + Process.setArgV0(Process.is64Bit() ? "usap64" : "usap32"); LocalSocket sessionSocket = null; DataOutputStream usapOutputStream = null; diff --git a/core/res/res/values-night/themes_device_defaults.xml b/core/res/res/values-night/themes_device_defaults.xml index 0721f6fb3802..86405100d092 100644 --- a/core/res/res/values-night/themes_device_defaults.xml +++ b/core/res/res/values-night/themes_device_defaults.xml @@ -63,9 +63,11 @@ easier. <!-- Theme for the dialog shown when an app crashes or ANRs. --> <style name="Theme.DeviceDefault.Dialog.AppError" parent="Theme.DeviceDefault.Dialog.Alert" /> + <style name="Theme.DeviceDefault.Dialog.Alert.DayNight" parent="Theme.DeviceDefault.Dialog.Alert" /> <style name="Theme.DeviceDefault.DayNight" parent="Theme.DeviceDefault" /> <style name="ThemeOverlay.DeviceDefault.Accent.DayNight" parent="@style/ThemeOverlay.DeviceDefault.Accent" /> + </resources>
\ No newline at end of file diff --git a/core/res/res/values/themes_device_defaults.xml b/core/res/res/values/themes_device_defaults.xml index 9a95ecca5876..9f20ee6e19a0 100644 --- a/core/res/res/values/themes_device_defaults.xml +++ b/core/res/res/values/themes_device_defaults.xml @@ -1390,6 +1390,8 @@ easier. <item name="toolbarStyle">@style/Widget.DeviceDefault.Toolbar</item> </style> + <style name="Theme.DeviceDefault.Dialog.Alert.DayNight" parent="Theme.DeviceDefault.Light.Dialog.Alert" /> + <style name="Theme.DeviceDefault.Light.SearchBar" parent="Theme.Material.Light.SearchBar"> <!-- Color palette --> <item name="colorPrimary">@color/primary_device_default_light</item> diff --git a/core/tests/coretests/src/android/app/servertransaction/ClientTransactionTests.java b/core/tests/coretests/src/android/app/servertransaction/ClientTransactionTests.java index 52b26589279f..3d252fbddb80 100644 --- a/core/tests/coretests/src/android/app/servertransaction/ClientTransactionTests.java +++ b/core/tests/coretests/src/android/app/servertransaction/ClientTransactionTests.java @@ -30,6 +30,15 @@ import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; +/** + * Tests for {@link ClientTransaction}. + * + * <p>Build/Install/Run: + * atest FrameworksCoreTests:ClientTransactionTests + * + * <p>This test class is a part of Window Manager Service tests and specified in + * {@link com.android.server.wm.test.filters.FrameworksTestsFilter}. + */ @RunWith(AndroidJUnit4.class) @SmallTest @Presubmit diff --git a/core/tests/coretests/src/android/app/servertransaction/ObjectPoolTests.java b/core/tests/coretests/src/android/app/servertransaction/ObjectPoolTests.java index ad28d13dc46a..447f28e06d7e 100644 --- a/core/tests/coretests/src/android/app/servertransaction/ObjectPoolTests.java +++ b/core/tests/coretests/src/android/app/servertransaction/ObjectPoolTests.java @@ -42,6 +42,15 @@ import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; +/** + * Tests for {@link ObjectPool}. + * + * <p>Build/Install/Run: + * atest FrameworksCoreTests:ObjectPoolTests + * + * <p>This test class is a part of Window Manager Service tests and specified in + * {@link com.android.server.wm.test.filters.FrameworksTestsFilter}. + */ @RunWith(AndroidJUnit4.class) @SmallTest @Presubmit diff --git a/core/tests/coretests/src/android/app/servertransaction/TransactionExecutorTests.java b/core/tests/coretests/src/android/app/servertransaction/TransactionExecutorTests.java index f730a244a593..1cca79954138 100644 --- a/core/tests/coretests/src/android/app/servertransaction/TransactionExecutorTests.java +++ b/core/tests/coretests/src/android/app/servertransaction/TransactionExecutorTests.java @@ -26,9 +26,8 @@ import static android.app.servertransaction.ActivityLifecycleItem.ON_STOP; import static android.app.servertransaction.ActivityLifecycleItem.PRE_ON_CREATE; import static android.app.servertransaction.ActivityLifecycleItem.UNDEFINED; -import static junit.framework.Assert.assertEquals; - import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.inOrder; @@ -61,7 +60,15 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -/** Test {@link TransactionExecutor} logic. */ +/** + * Test {@link TransactionExecutor} logic. + * + * <p>Build/Install/Run: + * atest FrameworksCoreTests:TransactionExecutorTests + * + * <p>This test class is a part of Window Manager Service tests and specified in + * {@link com.android.server.wm.test.filters.FrameworksTestsFilter}. + */ @RunWith(AndroidJUnit4.class) @SmallTest @Presubmit diff --git a/core/tests/coretests/src/android/app/servertransaction/TransactionParcelTests.java b/core/tests/coretests/src/android/app/servertransaction/TransactionParcelTests.java index d73c174212bd..d117b4096ca0 100644 --- a/core/tests/coretests/src/android/app/servertransaction/TransactionParcelTests.java +++ b/core/tests/coretests/src/android/app/servertransaction/TransactionParcelTests.java @@ -21,8 +21,8 @@ import static android.app.servertransaction.TestUtils.mergedConfig; import static android.app.servertransaction.TestUtils.referrerIntentList; import static android.app.servertransaction.TestUtils.resultInfoList; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import android.app.IApplicationThread; import android.app.IInstrumentationWatcher; @@ -64,7 +64,15 @@ import org.junit.runner.RunWith; import java.util.List; import java.util.Map; -/** Test parcelling and unparcelling of transactions and transaction items. */ +/** + * Test parcelling and unparcelling of transactions and transaction items. + * + * <p>Build/Install/Run: + * atest FrameworksCoreTests:TransactionParcelTests + * + * <p>This test class is a part of Window Manager Service tests and specified in + * {@link com.android.server.wm.test.filters.FrameworksTestsFilter}. + */ @RunWith(AndroidJUnit4.class) @SmallTest @Presubmit diff --git a/core/tests/coretests/src/android/view/DisplayCutoutTest.java b/core/tests/coretests/src/android/view/DisplayCutoutTest.java index dd50af877bbb..182fe78dfa7a 100644 --- a/core/tests/coretests/src/android/view/DisplayCutoutTest.java +++ b/core/tests/coretests/src/android/view/DisplayCutoutTest.java @@ -44,6 +44,15 @@ import org.junit.runner.RunWith; import java.util.Arrays; import java.util.Collections; +/** + * Tests for {@link DisplayCutout}. + * + * <p>Build/Install/Run: + * atest FrameworksCoreTests:DisplayCutoutTest + * + * <p>This test class is a part of Window Manager Service tests and specified in + * {@link com.android.server.wm.test.filters.FrameworksTestsFilter}. + */ @RunWith(AndroidJUnit4.class) @SmallTest @Presubmit diff --git a/core/tests/coretests/src/android/view/InsetsAnimationControlImplTest.java b/core/tests/coretests/src/android/view/InsetsAnimationControlImplTest.java index 23ab05e952a3..ebbbdec7d376 100644 --- a/core/tests/coretests/src/android/view/InsetsAnimationControlImplTest.java +++ b/core/tests/coretests/src/android/view/InsetsAnimationControlImplTest.java @@ -18,18 +18,15 @@ package android.view; import static android.view.InsetsState.TYPE_NAVIGATION_BAR; import static android.view.InsetsState.TYPE_TOP_BAR; - import static android.view.ViewRootImpl.NEW_INSETS_MODE_FULL; import static android.view.WindowInsets.Type.sideBars; import static android.view.WindowInsets.Type.systemBars; -import static android.view.WindowInsets.Type.topBar; -import static junit.framework.Assert.assertEquals; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -55,6 +52,15 @@ import org.mockito.MockitoAnnotations; import java.util.List; +/** + * Tests for {@link InsetsAnimationControlImpl}. + * + * <p>Build/Install/Run: + * atest FrameworksCoreTests:InsetsAnimationControlImplTest + * + * <p>This test class is a part of Window Manager Service tests and specified in + * {@link com.android.server.wm.test.filters.FrameworksTestsFilter}. + */ @Presubmit @FlakyTest(detail = "Promote once confirmed non-flaky") @RunWith(AndroidJUnit4.class) diff --git a/core/tests/coretests/src/android/view/InsetsControllerTest.java b/core/tests/coretests/src/android/view/InsetsControllerTest.java index d71bde837d6f..4d8d3f68f875 100644 --- a/core/tests/coretests/src/android/view/InsetsControllerTest.java +++ b/core/tests/coretests/src/android/view/InsetsControllerTest.java @@ -19,13 +19,13 @@ package android.view; import static android.view.InsetsState.TYPE_IME; import static android.view.InsetsState.TYPE_NAVIGATION_BAR; import static android.view.InsetsState.TYPE_TOP_BAR; - import static android.view.WindowInsets.Type.topBar; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertNull; -import static junit.framework.Assert.assertTrue; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.mock; @@ -53,6 +53,15 @@ import org.mockito.ArgumentCaptor; import java.util.concurrent.CountDownLatch; +/** + * Tests for {@link InsetsController}. + * + * <p>Build/Install/Run: + * atest FrameworksCoreTests:InsetsControllerTest + * + * <p>This test class is a part of Window Manager Service tests and specified in + * {@link com.android.server.wm.test.filters.FrameworksTestsFilter}. + */ @Presubmit @FlakyTest(detail = "Promote once confirmed non-flaky") @RunWith(AndroidJUnit4.class) diff --git a/core/tests/coretests/src/android/view/InsetsSourceConsumerTest.java b/core/tests/coretests/src/android/view/InsetsSourceConsumerTest.java index 4266ba9fe86e..a32fa778e736 100644 --- a/core/tests/coretests/src/android/view/InsetsSourceConsumerTest.java +++ b/core/tests/coretests/src/android/view/InsetsSourceConsumerTest.java @@ -43,6 +43,15 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +/** + * Tests for {@link InsetsSourceConsumer}. + * + * <p>Build/Install/Run: + * atest FrameworksCoreTests:InsetsSourceConsumerTest + * + * <p>This test class is a part of Window Manager Service tests and specified in + * {@link com.android.server.wm.test.filters.FrameworksTestsFilter}. + */ @Presubmit @FlakyTest(detail = "Promote once confirmed non-flaky") @RunWith(AndroidJUnit4.class) diff --git a/core/tests/coretests/src/android/view/InsetsSourceTest.java b/core/tests/coretests/src/android/view/InsetsSourceTest.java index 98ab3e785d0a..b55a9c600a61 100644 --- a/core/tests/coretests/src/android/view/InsetsSourceTest.java +++ b/core/tests/coretests/src/android/view/InsetsSourceTest.java @@ -18,7 +18,7 @@ package android.view; import static android.view.InsetsState.TYPE_NAVIGATION_BAR; -import static junit.framework.Assert.assertEquals; +import static org.junit.Assert.assertEquals; import android.graphics.Insets; import android.graphics.Rect; @@ -31,6 +31,15 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +/** + * Tests for {@link InsetsSource}. + * + * <p>Build/Install/Run: + * atest FrameworksCoreTests:InsetsSourceTest + * + * <p>This test class is a part of Window Manager Service tests and specified in + * {@link com.android.server.wm.test.filters.FrameworksTestsFilter}. + */ @Presubmit @FlakyTest(detail = "Promote once confirmed non-flaky") @RunWith(AndroidJUnit4.class) diff --git a/core/tests/coretests/src/android/view/InsetsStateTest.java b/core/tests/coretests/src/android/view/InsetsStateTest.java index bd036b01c0cf..8e167da84e08 100644 --- a/core/tests/coretests/src/android/view/InsetsStateTest.java +++ b/core/tests/coretests/src/android/view/InsetsStateTest.java @@ -24,14 +24,13 @@ import static android.view.InsetsState.TYPE_SIDE_BAR_1; import static android.view.InsetsState.TYPE_SIDE_BAR_2; import static android.view.InsetsState.TYPE_SIDE_BAR_3; import static android.view.InsetsState.TYPE_TOP_BAR; - import static android.view.WindowInsets.Type.ime; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertTrue; import android.graphics.Insets; import android.graphics.Rect; @@ -47,6 +46,15 @@ import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; +/** + * Tests for {@link InsetsState}. + * + * <p>Build/Install/Run: + * atest FrameworksCoreTests:InsetsStateTest + * + * <p>This test class is a part of Window Manager Service tests and specified in + * {@link com.android.server.wm.test.filters.FrameworksTestsFilter}. + */ @Presubmit @FlakyTest(detail = "Promote once confirmed non-flaky") @RunWith(AndroidJUnit4.class) diff --git a/graphics/java/android/graphics/RenderNode.java b/graphics/java/android/graphics/RenderNode.java index 9b4f2c1b51d5..ae7fe6c46f2f 100644 --- a/graphics/java/android/graphics/RenderNode.java +++ b/graphics/java/android/graphics/RenderNode.java @@ -284,9 +284,10 @@ public final class RenderNode { private static final class CompositePositionUpdateListener implements PositionUpdateListener { private final PositionUpdateListener[] mListeners; + private static final PositionUpdateListener[] sEmpty = new PositionUpdateListener[0]; CompositePositionUpdateListener(PositionUpdateListener... listeners) { - mListeners = listeners; + mListeners = listeners != null ? listeners : sEmpty; } public CompositePositionUpdateListener with(PositionUpdateListener listener) { diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 1da1405f469a..baa2055a1736 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -1023,8 +1023,8 @@ <dimen name="ongoing_appops_chip_bg_corner_radius">16dp</dimen> - <!-- How much a bubble is elevated --> - <dimen name="bubble_elevation">8dp</dimen> + <!-- How much each bubble is elevated. --> + <dimen name="bubble_elevation">1dp</dimen> <!-- Padding around a collapsed bubble --> <dimen name="bubble_view_padding">0dp</dimen> <!-- Padding between bubbles when displayed in expanded state --> diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java index 4a2731e5437a..0e691fbb0f4e 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java @@ -80,8 +80,6 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe private static final String TAG = "BubbleController"; - private static final int MAX_BUBBLES = 5; // TODO: actually enforce this - @Retention(SOURCE) @IntDef({DISMISS_USER_GESTURE, DISMISS_AGED, DISMISS_TASK_FINISHED, DISMISS_BLOCKED, DISMISS_NOTIF_CANCEL, DISMISS_ACCESSIBILITY_ACTION}) @@ -94,6 +92,8 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe static final int DISMISS_NOTIF_CANCEL = 5; static final int DISMISS_ACCESSIBILITY_ACTION = 6; + static final int MAX_BUBBLES = 5; // TODO: actually enforce this + // Enables some subset of notifs to automatically become bubbles private static final boolean DEBUG_ENABLE_AUTO_BUBBLE = false; diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java index 8e3afd8bcae0..ec6ea5508a47 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java @@ -437,7 +437,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList } boolean performBackPressIfNeeded() { - if (mActivityView == null || !usingActivityView()) { + if (!usingActivityView()) { return false; } mActivityView.performBackPress(); @@ -593,7 +593,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList } private boolean usingActivityView() { - return mBubbleIntent != null; + return mBubbleIntent != null && mActivityView != null; } private void applyRowState(ExpandableNotificationRow view) { diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java index 580acb82ebc1..b92b982b44b6 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java @@ -265,7 +265,9 @@ public class BubbleStackView extends FrameLayout { * Handle config changes. */ public void onConfigChanged() { - mExpandedBubble.expandedView.updateHeaderColor(); + if (mExpandedBubble != null) { + mExpandedBubble.expandedView.updateHeaderColor(); + } } @Override @@ -871,7 +873,8 @@ public class BubbleStackView extends FrameLayout { for (int i = 0; i < bubbsCount; i++) { BubbleView bv = (BubbleView) mBubbleContainer.getChildAt(i); bv.updateDotVisibility(); - bv.setZ(bubbsCount - i); + bv.setZ((BubbleController.MAX_BUBBLES + * getResources().getDimensionPixelSize(R.dimen.bubble_elevation)) - i); // Draw the shadow around the circle inscribed within the bubble's bounds. This // (intentionally) does not draw a shadow behind the update dot, which should be drawing diff --git a/packages/VpnDialogs/AndroidManifest.xml b/packages/VpnDialogs/AndroidManifest.xml index 1d0b9b6d83db..9f6ba03a10d9 100644 --- a/packages/VpnDialogs/AndroidManifest.xml +++ b/packages/VpnDialogs/AndroidManifest.xml @@ -27,7 +27,7 @@ android:allowBackup="false"> <activity android:name=".ConfirmDialog" - android:theme="@android:style/Theme.Material.Light.Dialog.Alert"> + android:theme="@*android:style/Theme.DeviceDefault.Dialog.Alert.DayNight"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.DEFAULT"/> @@ -35,7 +35,7 @@ </activity> <activity android:name=".ManageDialog" - android:theme="@android:style/Theme.Material.Light.Dialog.Alert" + android:theme="@*android:style/Theme.DeviceDefault.Dialog.Alert.DayNight" android:noHistory="true" android:excludeFromRecents="true" android:permission="android.permission.NETWORK_SETTINGS" @@ -44,7 +44,7 @@ <activity android:name=".AlwaysOnDisconnectedDialog" android:label="@string/always_on_disconnected_title" - android:theme="@android:style/Theme.Material.Light.Dialog.Alert" + android:theme="@*android:style/Theme.DeviceDefault.Dialog.Alert.DayNight" android:noHistory="true" android:excludeFromRecents="true" android:permission="android.permission.NETWORK_SETTINGS" diff --git a/services/appprediction/java/com/android/server/appprediction/RemoteAppPredictionService.java b/services/appprediction/java/com/android/server/appprediction/RemoteAppPredictionService.java index 21088e442212..19226be2e1ca 100644 --- a/services/appprediction/java/com/android/server/appprediction/RemoteAppPredictionService.java +++ b/services/appprediction/java/com/android/server/appprediction/RemoteAppPredictionService.java @@ -47,7 +47,8 @@ public class RemoteAppPredictionService extends RemoteAppPredictionServiceCallbacks callback, boolean bindInstantServiceAllowed, boolean verbose) { super(context, serviceInterface, componentName, userId, callback, - context.getMainThreadHandler(), bindInstantServiceAllowed, + context.getMainThreadHandler(), + bindInstantServiceAllowed ? Context.BIND_ALLOW_INSTANT : 0, verbose, /* initialCapacity= */ 1); } diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java index 87a265cf38d4..7020e7ea6965 100644 --- a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java +++ b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java @@ -198,6 +198,11 @@ public final class AutofillManagerService filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); context.registerReceiver(mBroadcastReceiver, filter, null, FgThread.getHandler()); + mAugmentedAutofillResolver = new FrameworkResourcesServiceNameResolver(getContext(), + com.android.internal.R.string.config_defaultAugmentedAutofillService); + mAugmentedAutofillResolver.setOnTemporaryServiceNameChangedCallback( + (u, s) -> getServiceForUserLocked(u).updateRemoteAugmentedAutofillService()); + if (mSupportedSmartSuggestionModes != AutofillManager.FLAG_SMART_SUGGESTION_OFF) { // Must eager load the services so they bind to the augmented autofill service final UserManager um = getContext().getSystemService(UserManager.class); @@ -207,11 +212,6 @@ public final class AutofillManagerService getServiceForUserLocked(userId); } } - - mAugmentedAutofillResolver = new FrameworkResourcesServiceNameResolver(getContext(), - com.android.internal.R.string.config_defaultAugmentedAutofillService); - mAugmentedAutofillResolver.setOnTemporaryServiceNameChangedCallback( - (u, s) -> getServiceForUserLocked(u).updateRemoteAugmentedAutofillService()); } @Override // from AbstractMasterSystemService diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java index ff284dcabfd0..d3cd48a81eab 100644 --- a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +++ b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java @@ -247,7 +247,8 @@ final class AutofillManagerServiceImpl if (isEnabledLocked()) return FLAG_ADD_CLIENT_ENABLED; // Check if it's enabled for augmented autofill - if (isSetupCompletedLocked() && isWhitelistedForAugmentedAutofillLocked(componentName)) { + if (isAugmentedAutofillServiceAvailableLocked() + && isWhitelistedForAugmentedAutofillLocked(componentName)) { return FLAG_ADD_CLIENT_ENABLED_FOR_AUGMENTED_AUTOFILL_ONLY; } @@ -1150,12 +1151,30 @@ final class AutofillManagerServiceImpl mRemoteAugmentedAutofillServiceInfo = null; } - if (isEnabledLocked()) { + final boolean available = isAugmentedAutofillServiceAvailableLocked(); + if (sVerbose) Slog.v(TAG, "updateRemoteAugmentedAutofillService(): " + available); + + if (available) { mRemoteAugmentedAutofillService = getRemoteAugmentedAutofillServiceLocked(); } } } + private boolean isAugmentedAutofillServiceAvailableLocked() { + if (mMaster.verbose) { + Slog.v(TAG, "isAugmentedAutofillService(): " + + "setupCompleted=" + isSetupCompletedLocked() + + ", disabled=" + isDisabledByUserRestrictionsLocked() + + ", augmentedService=" + + mMaster.mAugmentedAutofillResolver.getServiceName(mUserId)); + } + if (!isSetupCompletedLocked() || isDisabledByUserRestrictionsLocked() + || mMaster.mAugmentedAutofillResolver.getServiceName(mUserId) == null) { + return false; + } + return true; + } + /** * Sets which packages and activities can trigger augmented autofill. * diff --git a/services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java b/services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java index 3c17ac35f624..adf582925489 100644 --- a/services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java +++ b/services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java @@ -58,7 +58,8 @@ final class RemoteAugmentedAutofillService boolean bindInstantServiceAllowed, boolean verbose, int idleUnbindTimeoutMs, int requestTimeoutMs) { super(context, AugmentedAutofillService.SERVICE_INTERFACE, serviceName, userId, callbacks, - context.getMainThreadHandler(), bindInstantServiceAllowed, verbose); + context.getMainThreadHandler(), + bindInstantServiceAllowed ? Context.BIND_ALLOW_INSTANT : 0, verbose); mIdleUnbindTimeoutMs = idleUnbindTimeoutMs; mRequestTimeoutMs = requestTimeoutMs; diff --git a/services/autofill/java/com/android/server/autofill/RemoteFillService.java b/services/autofill/java/com/android/server/autofill/RemoteFillService.java index b8a7d44a4d10..0ce6c87f1f28 100644 --- a/services/autofill/java/com/android/server/autofill/RemoteFillService.java +++ b/services/autofill/java/com/android/server/autofill/RemoteFillService.java @@ -64,7 +64,8 @@ final class RemoteFillService RemoteFillService(Context context, ComponentName componentName, int userId, FillServiceCallbacks callbacks, boolean bindInstantServiceAllowed) { super(context, AutofillService.SERVICE_INTERFACE, componentName, userId, callbacks, - context.getMainThreadHandler(), bindInstantServiceAllowed, sVerbose); + context.getMainThreadHandler(), Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS + | (bindInstantServiceAllowed ? Context.BIND_ALLOW_INSTANT : 0), sVerbose); mCallbacks = callbacks; } diff --git a/services/contentcapture/java/com/android/server/contentcapture/RemoteContentCaptureService.java b/services/contentcapture/java/com/android/server/contentcapture/RemoteContentCaptureService.java index df9ccbc499ba..0afe252d96bd 100644 --- a/services/contentcapture/java/com/android/server/contentcapture/RemoteContentCaptureService.java +++ b/services/contentcapture/java/com/android/server/contentcapture/RemoteContentCaptureService.java @@ -47,7 +47,8 @@ final class RemoteContentCaptureService ContentCapturePerUserService perUserService, boolean bindInstantServiceAllowed, boolean verbose, int idleUnbindTimeoutMs) { super(context, serviceInterface, serviceComponentName, userId, perUserService, - context.getMainThreadHandler(), bindInstantServiceAllowed, verbose, + context.getMainThreadHandler(), + bindInstantServiceAllowed ? Context.BIND_ALLOW_INSTANT : 0, verbose, /* initialCapacity= */ 2); mPerUserService = perUserService; mServerCallback = callback.asBinder(); diff --git a/services/contentsuggestions/java/com/android/server/contentsuggestions/RemoteContentSuggestionsService.java b/services/contentsuggestions/java/com/android/server/contentsuggestions/RemoteContentSuggestionsService.java index 442972a1e477..4b36352bac51 100644 --- a/services/contentsuggestions/java/com/android/server/contentsuggestions/RemoteContentSuggestionsService.java +++ b/services/contentsuggestions/java/com/android/server/contentsuggestions/RemoteContentSuggestionsService.java @@ -47,7 +47,8 @@ public class RemoteContentSuggestionsService extends int userId, Callbacks callbacks, boolean bindInstantServiceAllowed, boolean verbose) { super(context, ContentSuggestionsService.SERVICE_INTERFACE, serviceName, userId, callbacks, - context.getMainThreadHandler(), bindInstantServiceAllowed, verbose, + context.getMainThreadHandler(), + bindInstantServiceAllowed ? Context.BIND_ALLOW_INSTANT : 0, verbose, /* initialCapacity= */ 1); } diff --git a/services/core/java/com/android/server/infra/AbstractPerUserSystemService.java b/services/core/java/com/android/server/infra/AbstractPerUserSystemService.java index ac07e9d6b0b7..c52921ef344b 100644 --- a/services/core/java/com/android/server/infra/AbstractPerUserSystemService.java +++ b/services/core/java/com/android/server/infra/AbstractPerUserSystemService.java @@ -113,6 +113,13 @@ public abstract class AbstractPerUserSystemService<S extends AbstractPerUserSyst } /** + * Gets whether the service is disabled by {@link UserManager} restrictions. + */ + protected final boolean isDisabledByUserRestrictionsLocked() { + return mDisabled; + } + + /** * Updates the state of this service. * * <p>Typically called when the service {@link Settings} property or {@link UserManager} @@ -136,7 +143,9 @@ public abstract class AbstractPerUserSystemService<S extends AbstractPerUserSyst + ", disabled=" + disabled + ", mDisabled=" + mDisabled); } - mSetupComplete = isSetupCompletedLocked(); + final String setupComplete = Settings.Secure.getStringForUser( + getContext().getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, mUserId); + mSetupComplete = "1".equals(setupComplete); mDisabled = disabled; updateServiceInfoLocked(); @@ -235,6 +244,15 @@ public abstract class AbstractPerUserSystemService<S extends AbstractPerUserSyst } /** + * Gets the {@link ServiceInfo} of the remote service this service binds to, or {@code null} + * if the service is disabled. + */ + @Nullable + public final ServiceInfo getServiceInfo() { + return mServiceInfo; + } + + /** * Gets the {@link ComponentName} of the remote service this service binds to, or {@code null} * if the service is disabled. */ @@ -311,9 +329,7 @@ public abstract class AbstractPerUserSystemService<S extends AbstractPerUserSyst * Gets whether the device already finished setup. */ protected final boolean isSetupCompletedLocked() { - final String setupComplete = Settings.Secure.getStringForUser( - getContext().getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, mUserId); - return "1".equals(setupComplete); + return mSetupComplete; } /** diff --git a/services/core/java/com/android/server/wm/AppWindowThumbnail.java b/services/core/java/com/android/server/wm/AppWindowThumbnail.java index bbbf11d2a7a2..9f7cb3d35ecb 100644 --- a/services/core/java/com/android/server/wm/AppWindowThumbnail.java +++ b/services/core/java/com/android/server/wm/AppWindowThumbnail.java @@ -49,7 +49,7 @@ class AppWindowThumbnail implements Animatable { private static final String TAG = TAG_WITH_CLASS_NAME ? "AppWindowThumbnail" : TAG_WM; private final AppWindowToken mAppToken; - private final SurfaceControl mSurfaceControl; + private SurfaceControl mSurfaceControl; private final SurfaceAnimator mSurfaceAnimator; private final int mWidth; private final int mHeight; @@ -68,10 +68,21 @@ class AppWindowThumbnail implements Animatable { */ AppWindowThumbnail(Transaction t, AppWindowToken appToken, GraphicBuffer thumbnailHeader, boolean relative) { + this(t, appToken, thumbnailHeader, relative, new Surface(), null); + } + + AppWindowThumbnail(Transaction t, AppWindowToken appToken, GraphicBuffer thumbnailHeader, + boolean relative, Surface drawSurface, SurfaceAnimator animator) { mAppToken = appToken; mRelative = relative; - mSurfaceAnimator = + if (animator != null) { + mSurfaceAnimator = animator; + } else { + // We can't use a delegating constructor since we need to + // reference this::onAnimationFinished + mSurfaceAnimator = new SurfaceAnimator(this, this::onAnimationFinished, appToken.mWmService); + } mWidth = thumbnailHeader.getWidth(); mHeight = thumbnailHeader.getHeight(); @@ -95,7 +106,6 @@ class AppWindowThumbnail implements Animatable { } // Transfer the thumbnail to the surface - Surface drawSurface = new Surface(); drawSurface.copyFrom(mSurfaceControl); drawSurface.attachAndQueueBuffer(thumbnailHeader); drawSurface.release(); @@ -145,6 +155,7 @@ class AppWindowThumbnail implements Animatable { void destroy() { mSurfaceAnimator.cancelAnimation(); getPendingTransaction().remove(mSurfaceControl); + mSurfaceControl = null; } /** diff --git a/services/tests/wmtests/src/com/android/server/wm/AnimatingAppWindowTokenRegistryTest.java b/services/tests/wmtests/src/com/android/server/wm/AnimatingAppWindowTokenRegistryTest.java index febb79540fea..380f7c67402e 100644 --- a/services/tests/wmtests/src/com/android/server/wm/AnimatingAppWindowTokenRegistryTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/AnimatingAppWindowTokenRegistryTest.java @@ -22,12 +22,11 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; import static com.android.dx.mockito.inline.extended.ExtendedMockito.verifyZeroInteractions; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertTrue; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import android.platform.test.annotations.Presubmit; -import androidx.test.filters.FlakyTest; import androidx.test.filters.SmallTest; import org.junit.Before; diff --git a/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java index 9bd993070939..b1ffbbd4ffba 100644 --- a/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java @@ -24,9 +24,9 @@ import static android.view.WindowManager.TRANSIT_TASK_CHANGE_WINDOWING_MODE; import static android.view.WindowManager.TRANSIT_TASK_CLOSE; import static android.view.WindowManager.TRANSIT_TASK_OPEN; -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import android.platform.test.annotations.Presubmit; import android.view.WindowManager; diff --git a/services/tests/wmtests/src/com/android/server/wm/AppWindowThumbnailTest.java b/services/tests/wmtests/src/com/android/server/wm/AppWindowThumbnailTest.java new file mode 100644 index 000000000000..fa0c384ca89d --- /dev/null +++ b/services/tests/wmtests/src/com/android/server/wm/AppWindowThumbnailTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.wm; + +import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock; + +import static com.android.dx.mockito.inline.extended.ExtendedMockito.when; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import android.graphics.GraphicBuffer; +import android.graphics.PixelFormat; +import android.platform.test.annotations.Presubmit; +import android.view.Surface; +import android.view.SurfaceControl; + +import androidx.test.filters.SmallTest; + +import org.junit.Test; + +/** + * Test class for {@link TaskSnapshotSurface}. + * + * Build/Install/Run: + * atest FrameworksServicesTest:AppWindowThumbnailTest + * + */ +@SmallTest +@Presubmit +public class AppWindowThumbnailTest extends WindowTestsBase { + private AppWindowThumbnail buildThumbnail() { + final GraphicBuffer buffer = GraphicBuffer.create(1, 1, PixelFormat.RGBA_8888, + GraphicBuffer.USAGE_SW_READ_RARELY | GraphicBuffer.USAGE_SW_WRITE_NEVER); + final AppWindowToken mockAwt = mock(AppWindowToken.class); + when(mockAwt.getPendingTransaction()).thenReturn(new StubTransaction()); + when(mockAwt.makeSurface()).thenReturn(new MockSurfaceControlBuilder()); + return new AppWindowThumbnail(new StubTransaction(), mockAwt, + buffer, false, mock(Surface.class), mock(SurfaceAnimator.class)); + } + + @Test + public void testDestroy_nullsSurface() { + final AppWindowThumbnail t = buildThumbnail(); + assertNotNull(t.getSurfaceControl()); + t.destroy(); + assertNull(t.getSurfaceControl()); + } +} diff --git a/services/tests/wmtests/src/com/android/server/wm/PersisterQueueTests.java b/services/tests/wmtests/src/com/android/server/wm/PersisterQueueTests.java index a166444ce871..4e906bc9b6c3 100644 --- a/services/tests/wmtests/src/com/android/server/wm/PersisterQueueTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/PersisterQueueTests.java @@ -18,11 +18,10 @@ package com.android.server.wm; import static com.google.common.truth.Truth.assertWithMessage; -import static junit.framework.Assert.assertNull; -import static junit.framework.Assert.assertSame; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import android.os.SystemClock; diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotCacheTest.java b/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotCacheTest.java index 1c6afd545b1f..3bedabc45c00 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotCacheTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotCacheTest.java @@ -18,8 +18,8 @@ package com.android.server.wm; import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertNull; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import android.platform.test.annotations.Presubmit; diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotControllerTest.java index 792e8a6f7582..113f3c8e237c 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotControllerTest.java @@ -23,7 +23,7 @@ import static android.view.WindowManager.TRANSIT_UNSET; import static com.android.server.wm.TaskSnapshotController.SNAPSHOT_MODE_APP_THEME; import static com.android.server.wm.TaskSnapshotController.SNAPSHOT_MODE_REAL; -import static junit.framework.Assert.assertEquals; +import static org.junit.Assert.assertEquals; import android.platform.test.annotations.Presubmit; import android.util.ArraySet; diff --git a/services/tests/wmtests/src/com/android/server/wm/UnknownAppVisibilityControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/UnknownAppVisibilityControllerTest.java index 8854edef9994..a91daf0c7647 100644 --- a/services/tests/wmtests/src/com/android/server/wm/UnknownAppVisibilityControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/UnknownAppVisibilityControllerTest.java @@ -16,9 +16,8 @@ package com.android.server.wm; -import static junit.framework.Assert.assertTrue; +import static org.junit.Assert.assertTrue; -import android.os.SystemClock; import android.platform.test.annotations.Presubmit; import androidx.test.filters.SmallTest; diff --git a/tests/utils/testutils/java/com/android/server/wm/test/filters/CoreTestsFilter.java b/tests/utils/testutils/java/com/android/server/wm/test/filters/FrameworksTestsFilter.java index 1a81c2c9fd41..e0d74e0908ee 100644 --- a/tests/utils/testutils/java/com/android/server/wm/test/filters/CoreTestsFilter.java +++ b/tests/utils/testutils/java/com/android/server/wm/test/filters/FrameworksTestsFilter.java @@ -26,23 +26,25 @@ import com.android.test.filters.SelectTest; * <p>Use this filter when running FrameworksCoreTests as * <pre> * adb shell am instrument -w \ - * -e filter com.android.server.wm.test.filters.CoreTestsFilter \ + * -e filter com.android.server.wm.test.filters.FrameworksTestsFilter \ * -e selectTest_verbose true \ * com.android.frameworks.coretests/androidx.test.runner.AndroidJUnitRunner * </pre> */ -public final class CoreTestsFilter extends SelectTest { +public final class FrameworksTestsFilter extends SelectTest { - private static final String[] SELECTED_CORE_TESTS = { + private static final String[] SELECTED_TESTS = { + // Test specifications for FrameworksCoreTests. "android.app.servertransaction.", // all tests under the package. "android.view.DisplayCutoutTest", + "android.view.InsetsAnimationControlImplTest", "android.view.InsetsControllerTest", "android.view.InsetsSourceTest", "android.view.InsetsSourceConsumerTest", "android.view.InsetsStateTest", }; - public CoreTestsFilter(Bundle testArgs) { - super(addSelectTest(testArgs, SELECTED_CORE_TESTS)); + public FrameworksTestsFilter(Bundle testArgs) { + super(addSelectTest(testArgs, SELECTED_TESTS)); } } diff --git a/wifi/java/android/net/wifi/WifiNetworkSuggestion.java b/wifi/java/android/net/wifi/WifiNetworkSuggestion.java index a9c9939875e9..f5767453a6fb 100644 --- a/wifi/java/android/net/wifi/WifiNetworkSuggestion.java +++ b/wifi/java/android/net/wifi/WifiNetworkSuggestion.java @@ -283,10 +283,10 @@ public final class WifiNetworkSuggestion implements Parcelable { /** * Specify the priority of this network among other network suggestions provided by the same - * app (priorities have no impact on suggestions by different apps). The lower the number, - * the higher the priority (i.e value of 0 = highest priority). + * app (priorities have no impact on suggestions by different apps). The higher the number, + * the higher the priority (i.e value of 0 = lowest priority). * <p> - * <li>If not set, defaults to -1 (i.e unassigned priority).</li> + * <li>If not set, defaults a lower priority than any assigned priority.</li> * * @param priority Integer number representing the priority among suggestions by the app. * @return Instance of {@link Builder} to enable chaining of the builder method. |