diff options
| author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-09-21 23:21:41 +0000 |
|---|---|---|
| committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-09-21 23:21:41 +0000 |
| commit | c5684b8b2a73f9f9857529ea1b04d834499cccca (patch) | |
| tree | 444d0bc8b906d8b993c5075effd553f66ed6acb8 /core/java | |
| parent | 817fb942e2281758938f30373335998a22fd8a59 (diff) | |
| parent | bc3406f6383dcdec8fb31884d342f1deea38f45e (diff) | |
Snap for 9088299 from bc3406f6383dcdec8fb31884d342f1deea38f45e to tm-qpr1-release
Change-Id: I07f8b2f9dac790d28a648f6fb57811e9557225a8
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/net/Ikev2VpnProfile.java | 5 | ||||
| -rw-r--r-- | core/java/android/provider/Settings.java | 7 | ||||
| -rw-r--r-- | core/java/android/util/FeatureFlagUtils.java | 6 | ||||
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 2 | ||||
| -rw-r--r-- | core/java/android/window/TaskFragmentInfo.java | 4 | ||||
| -rw-r--r-- | core/java/android/window/TaskFragmentParentInfo.aidl | 23 | ||||
| -rw-r--r-- | core/java/android/window/TaskFragmentParentInfo.java | 158 | ||||
| -rw-r--r-- | core/java/android/window/TaskFragmentTransaction.java | 36 | ||||
| -rw-r--r-- | core/java/com/android/internal/app/SimpleIconFactory.java | 15 | ||||
| -rw-r--r-- | core/java/com/android/internal/widget/LockPatternUtils.java | 53 |
10 files changed, 276 insertions, 33 deletions
diff --git a/core/java/android/net/Ikev2VpnProfile.java b/core/java/android/net/Ikev2VpnProfile.java index 3979c6c78dcb..10ce3bf78b2a 100644 --- a/core/java/android/net/Ikev2VpnProfile.java +++ b/core/java/android/net/Ikev2VpnProfile.java @@ -483,9 +483,6 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { final VpnProfile profile = new VpnProfile("" /* Key; value unused by IKEv2VpnProfile(s) */, mIsRestrictedToTestNetworks, mExcludeLocalRoutes, mRequiresInternetValidation, mIkeTunConnParams); - - profile.server = getServerAddr(); - profile.ipsecIdentifier = getUserIdentity(); profile.proxy = mProxyInfo; profile.isBypassable = mIsBypassable; profile.isMetered = mIsMetered; @@ -499,6 +496,8 @@ public final class Ikev2VpnProfile extends PlatformVpnProfile { } profile.type = mType; + profile.server = getServerAddr(); + profile.ipsecIdentifier = getUserIdentity(); profile.setAllowedAlgorithms(mAllowedAlgorithms); switch (mType) { case TYPE_IKEV2_IPSEC_USER_PASS: diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index b964e1c326a4..6e369d343fa2 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -7427,6 +7427,13 @@ public final class Settings { "trust_agents_initialized"; /** + * Set to 1 by the system after the list of known trust agents have been initialized. + * @hide + */ + public static final String KNOWN_TRUST_AGENTS_INITIALIZED = + "known_trust_agents_initialized"; + + /** * The Logging ID (a unique 64-bit value) as a hex string. * Used as a pseudonymous identifier for logging. * @deprecated This identifier is poorly initialized and has diff --git a/core/java/android/util/FeatureFlagUtils.java b/core/java/android/util/FeatureFlagUtils.java index 976a3e4d4cde..c218a0ba2f49 100644 --- a/core/java/android/util/FeatureFlagUtils.java +++ b/core/java/android/util/FeatureFlagUtils.java @@ -83,11 +83,6 @@ public class FeatureFlagUtils { public static final String SETTINGS_HIDE_SECOND_LAYER_PAGE_NAVIGATE_UP_BUTTON_IN_TWO_PANE = "settings_hide_second_layer_page_navigate_up_button_in_two_pane"; - /** Support Clear Calling feature. - * @hide - */ - public static final String SETTINGS_ENABLE_CLEAR_CALLING = "settings_enable_clear_calling"; - private static final Map<String, String> DEFAULT_FLAGS; static { @@ -115,7 +110,6 @@ public class FeatureFlagUtils { DEFAULT_FLAGS.put(SETTINGS_ENABLE_MONITOR_PHANTOM_PROCS, "true"); DEFAULT_FLAGS.put(SETTINGS_APP_ALLOW_DARK_THEME_ACTIVATION_AT_BEDTIME, "true"); DEFAULT_FLAGS.put(SETTINGS_HIDE_SECOND_LAYER_PAGE_NAVIGATE_UP_BUTTON_IN_TWO_PANE, "true"); - DEFAULT_FLAGS.put(SETTINGS_ENABLE_CLEAR_CALLING, "false"); } private static final Set<String> PERSISTENT_FLAGS; diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index e4caa385bc9b..a78d10aaf1ad 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -284,7 +284,7 @@ public final class ViewRootImpl implements ViewParent, * @hide */ public static final boolean LOCAL_LAYOUT = - SystemProperties.getBoolean("persist.debug.local_layout", false); + SystemProperties.getBoolean("persist.debug.local_layout", true); /** * Set this system property to true to force the view hierarchy to render diff --git a/core/java/android/window/TaskFragmentInfo.java b/core/java/android/window/TaskFragmentInfo.java index 56e910769cb5..e2c8a31cc987 100644 --- a/core/java/android/window/TaskFragmentInfo.java +++ b/core/java/android/window/TaskFragmentInfo.java @@ -188,6 +188,10 @@ public final class TaskFragmentInfo implements Parcelable { /** * Returns {@code true} if the parameters that are important for task fragment organizers are * equal between this {@link TaskFragmentInfo} and {@param that}. + * Note that this method is usually called with + * {@link com.android.server.wm.WindowOrganizerController#configurationsAreEqualForOrganizer( + * Configuration, Configuration)} to determine if this {@link TaskFragmentInfo} should + * be dispatched to the client. */ public boolean equalsForTaskFragmentOrganizer(@Nullable TaskFragmentInfo that) { if (that == null) { diff --git a/core/java/android/window/TaskFragmentParentInfo.aidl b/core/java/android/window/TaskFragmentParentInfo.aidl new file mode 100644 index 000000000000..79d2209ab244 --- /dev/null +++ b/core/java/android/window/TaskFragmentParentInfo.aidl @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2022 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.window; + +/** + * The information about the parent Task of a particular TaskFragment + * @hide + */ +parcelable TaskFragmentParentInfo;
\ No newline at end of file diff --git a/core/java/android/window/TaskFragmentParentInfo.java b/core/java/android/window/TaskFragmentParentInfo.java new file mode 100644 index 000000000000..64b2638407df --- /dev/null +++ b/core/java/android/window/TaskFragmentParentInfo.java @@ -0,0 +1,158 @@ +/* + * Copyright (C) 2022 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.window; + +import android.annotation.NonNull; +import android.annotation.Nullable; +import android.app.WindowConfiguration; +import android.content.res.Configuration; +import android.os.Parcel; +import android.os.Parcelable; + +/** + * The information about the parent Task of a particular TaskFragment + * @hide + */ +public class TaskFragmentParentInfo implements Parcelable { + @NonNull + private final Configuration mConfiguration = new Configuration(); + + private final int mDisplayId; + + private final boolean mVisibleRequested; + + public TaskFragmentParentInfo(@NonNull Configuration configuration, int displayId, + boolean visibleRequested) { + mConfiguration.setTo(configuration); + mDisplayId = displayId; + mVisibleRequested = visibleRequested; + } + + public TaskFragmentParentInfo(@NonNull TaskFragmentParentInfo info) { + mConfiguration.setTo(info.getConfiguration()); + mDisplayId = info.mDisplayId; + mVisibleRequested = info.mVisibleRequested; + } + + /** The {@link Configuration} of the parent Task */ + @NonNull + public Configuration getConfiguration() { + return mConfiguration; + } + + /** + * The display ID of the parent Task. {@link android.view.Display#INVALID_DISPLAY} means the + * Task is detached from previously associated display. + */ + public int getDisplayId() { + return mDisplayId; + } + + /** Whether the parent Task is requested to be visible or not */ + public boolean isVisibleRequested() { + return mVisibleRequested; + } + + /** + * Returns {@code true} if the parameters which are important for task fragment + * organizers are equal between this {@link TaskFragmentParentInfo} and {@code that}. + * Note that this method is usually called with + * {@link com.android.server.wm.WindowOrganizerController#configurationsAreEqualForOrganizer( + * Configuration, Configuration)} to determine if this {@link TaskFragmentParentInfo} should + * be dispatched to the client. + */ + public boolean equalsForTaskFragmentOrganizer(@Nullable TaskFragmentParentInfo that) { + if (that == null) { + return false; + } + return getWindowingMode() == that.getWindowingMode() && mDisplayId == that.mDisplayId + && mVisibleRequested == that.mVisibleRequested; + } + + @WindowConfiguration.WindowingMode + private int getWindowingMode() { + return mConfiguration.windowConfiguration.getWindowingMode(); + } + + @Override + public String toString() { + return TaskFragmentParentInfo.class.getSimpleName() + ":{" + + "config=" + mConfiguration + + ", displayId=" + mDisplayId + + ", visibleRequested=" + mVisibleRequested + + "}"; + } + + /** + * Indicates that whether this {@link TaskFragmentParentInfo} equals to {@code obj}. + * Note that {@link #equalsForTaskFragmentOrganizer(TaskFragmentParentInfo)} should be used + * for most cases because not all {@link Configuration} properties are interested for + * {@link TaskFragmentOrganizer}. + */ + @Override + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof TaskFragmentParentInfo)) { + return false; + } + final TaskFragmentParentInfo that = (TaskFragmentParentInfo) obj; + return mConfiguration.equals(that.mConfiguration) + && mDisplayId == that.mDisplayId + && mVisibleRequested == that.mVisibleRequested; + } + + @Override + public int hashCode() { + int result = mConfiguration.hashCode(); + result = 31 * result + mDisplayId; + result = 31 * result + (mVisibleRequested ? 1 : 0); + return result; + } + + @Override + public void writeToParcel(@NonNull Parcel dest, int flags) { + mConfiguration.writeToParcel(dest, flags); + dest.writeInt(mDisplayId); + dest.writeBoolean(mVisibleRequested); + } + + private TaskFragmentParentInfo(Parcel in) { + mConfiguration.readFromParcel(in); + mDisplayId = in.readInt(); + mVisibleRequested = in.readBoolean(); + } + + public static final Creator<TaskFragmentParentInfo> CREATOR = + new Creator<TaskFragmentParentInfo>() { + @Override + public TaskFragmentParentInfo createFromParcel(Parcel in) { + return new TaskFragmentParentInfo(in); + } + + @Override + public TaskFragmentParentInfo[] newArray(int size) { + return new TaskFragmentParentInfo[size]; + } + }; + + @Override + public int describeContents() { + return 0; + } +} diff --git a/core/java/android/window/TaskFragmentTransaction.java b/core/java/android/window/TaskFragmentTransaction.java index 413c0dd77ed6..a8216069bd53 100644 --- a/core/java/android/window/TaskFragmentTransaction.java +++ b/core/java/android/window/TaskFragmentTransaction.java @@ -171,10 +171,6 @@ public final class TaskFragmentTransaction implements Parcelable { /** @see #setTaskId(int) */ private int mTaskId; - /** @see #setTaskConfiguration(Configuration) */ - @Nullable - private Configuration mTaskConfiguration; - /** @see #setErrorCallbackToken(IBinder) */ @Nullable private IBinder mErrorCallbackToken; @@ -191,6 +187,9 @@ public final class TaskFragmentTransaction implements Parcelable { @Nullable private IBinder mActivityToken; + @Nullable + private TaskFragmentParentInfo mTaskFragmentParentInfo; + public Change(@ChangeType int type) { mType = type; } @@ -200,11 +199,11 @@ public final class TaskFragmentTransaction implements Parcelable { mTaskFragmentToken = in.readStrongBinder(); mTaskFragmentInfo = in.readTypedObject(TaskFragmentInfo.CREATOR); mTaskId = in.readInt(); - mTaskConfiguration = in.readTypedObject(Configuration.CREATOR); mErrorCallbackToken = in.readStrongBinder(); mErrorBundle = in.readBundle(TaskFragmentTransaction.class.getClassLoader()); mActivityIntent = in.readTypedObject(Intent.CREATOR); mActivityToken = in.readStrongBinder(); + mTaskFragmentParentInfo = in.readTypedObject(TaskFragmentParentInfo.CREATOR); } @Override @@ -213,11 +212,11 @@ public final class TaskFragmentTransaction implements Parcelable { dest.writeStrongBinder(mTaskFragmentToken); dest.writeTypedObject(mTaskFragmentInfo, flags); dest.writeInt(mTaskId); - dest.writeTypedObject(mTaskConfiguration, flags); dest.writeStrongBinder(mErrorCallbackToken); dest.writeBundle(mErrorBundle); dest.writeTypedObject(mActivityIntent, flags); dest.writeStrongBinder(mActivityToken); + dest.writeTypedObject(mTaskFragmentParentInfo, flags); } /** The change is related to the TaskFragment created with this unique token. */ @@ -241,10 +240,10 @@ public final class TaskFragmentTransaction implements Parcelable { return this; } + // TODO(b/241043377): Keep this API to prevent @TestApi changes. Remove in the next release. /** Configuration of the parent Task. */ @NonNull public Change setTaskConfiguration(@NonNull Configuration configuration) { - mTaskConfiguration = requireNonNull(configuration); return this; } @@ -292,6 +291,19 @@ public final class TaskFragmentTransaction implements Parcelable { return this; } + // TODO(b/241043377): Hide this API to prevent @TestApi changes. Remove in the next release. + /** + * Sets info of the parent Task of the embedded TaskFragment. + * @see TaskFragmentParentInfo + * + * @hide pending unhide + */ + @NonNull + public Change setTaskFragmentParentInfo(@NonNull TaskFragmentParentInfo info) { + mTaskFragmentParentInfo = requireNonNull(info); + return this; + } + @ChangeType public int getType() { return mType; @@ -311,9 +323,10 @@ public final class TaskFragmentTransaction implements Parcelable { return mTaskId; } + // TODO(b/241043377): Keep this API to prevent @TestApi changes. Remove in the next release. @Nullable public Configuration getTaskConfiguration() { - return mTaskConfiguration; + return mTaskFragmentParentInfo.getConfiguration(); } @Nullable @@ -337,6 +350,13 @@ public final class TaskFragmentTransaction implements Parcelable { return mActivityToken; } + // TODO(b/241043377): Hide this API to prevent @TestApi changes. Remove in the next release. + /** @hide pending unhide */ + @Nullable + public TaskFragmentParentInfo getTaskFragmentParentInfo() { + return mTaskFragmentParentInfo; + } + @Override public String toString() { return "Change{ type=" + mType + " }"; diff --git a/core/java/com/android/internal/app/SimpleIconFactory.java b/core/java/com/android/internal/app/SimpleIconFactory.java index 354eb62ba045..be0b729aedfe 100644 --- a/core/java/com/android/internal/app/SimpleIconFactory.java +++ b/core/java/com/android/internal/app/SimpleIconFactory.java @@ -51,6 +51,7 @@ import android.util.Pools.SynchronizedPool; import android.util.TypedValue; import com.android.internal.R; +import com.android.internal.annotations.VisibleForTesting; import org.xmlpull.v1.XmlPullParser; @@ -69,6 +70,7 @@ public class SimpleIconFactory { private static final SynchronizedPool<SimpleIconFactory> sPool = new SynchronizedPool<>(Runtime.getRuntime().availableProcessors()); + private static boolean sPoolEnabled = true; private static final int DEFAULT_WRAPPER_BACKGROUND = Color.WHITE; private static final float BLUR_FACTOR = 1.5f / 48; @@ -92,7 +94,7 @@ public class SimpleIconFactory { */ @Deprecated public static SimpleIconFactory obtain(Context ctx) { - SimpleIconFactory instance = sPool.acquire(); + SimpleIconFactory instance = sPoolEnabled ? sPool.acquire() : null; if (instance == null) { final ActivityManager am = (ActivityManager) ctx.getSystemService(ACTIVITY_SERVICE); final int iconDpi = (am == null) ? 0 : am.getLauncherLargeIconDensity(); @@ -106,6 +108,17 @@ public class SimpleIconFactory { return instance; } + /** + * Enables or disables SimpleIconFactory objects pooling. It is enabled in production, you + * could use this method in tests and disable the pooling to make the icon rendering more + * deterministic because some sizing parameters will not be cached. Please ensure that you + * reset this value back after finishing the test. + */ + @VisibleForTesting + public static void setPoolEnabled(boolean poolEnabled) { + sPoolEnabled = poolEnabled; + } + private static int getAttrDimFromContext(Context ctx, @AttrRes int attrId, String errorMsg) { final Resources res = ctx.getResources(); TypedValue outVal = new TypedValue(); diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index a94b30707604..a4da8de44880 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -39,7 +39,6 @@ import android.content.pm.PackageManager; import android.content.pm.UserInfo; import android.os.Build; import android.os.Handler; -import android.os.IBinder; import android.os.Looper; import android.os.Message; import android.os.RemoteException; @@ -47,7 +46,6 @@ import android.os.ServiceManager; import android.os.SystemClock; import android.os.UserHandle; import android.os.UserManager; -import android.os.storage.IStorageManager; import android.os.storage.StorageManager; import android.provider.Settings; import android.text.TextUtils; @@ -175,6 +173,7 @@ public class LockPatternUtils { private static final String LOCK_SCREEN_DEVICE_OWNER_INFO = "lockscreen.device_owner_info"; private static final String ENABLED_TRUST_AGENTS = "lockscreen.enabledtrustagents"; + private static final String KNOWN_TRUST_AGENTS = "lockscreen.knowntrustagents"; private static final String IS_TRUST_USUALLY_MANAGED = "lockscreen.istrustusuallymanaged"; public static final String PROFILE_KEY_NAME_ENCRYPT = "profile_key_name_encrypt_"; @@ -1106,31 +1105,50 @@ public class LockPatternUtils { return getString(LOCKSCREEN_POWER_BUTTON_INSTANTLY_LOCKS, userId) != null; } + /** Updates the list of enabled trust agent in LockSettings storage for the given user. */ public void setEnabledTrustAgents(Collection<ComponentName> activeTrustAgents, int userId) { + setString(ENABLED_TRUST_AGENTS, serializeTrustAgents(activeTrustAgents), userId); + getTrustManager().reportEnabledTrustAgentsChanged(userId); + } + + /** Returns the list of enabled trust agent in LockSettings storage for the given user. */ + public List<ComponentName> getEnabledTrustAgents(int userId) { + return deserializeTrustAgents(getString(ENABLED_TRUST_AGENTS, userId)); + } + + /** Updates the list of known trust agent in LockSettings storage for the given user. */ + public void setKnownTrustAgents(Collection<ComponentName> knownTrustAgents, int userId) { + setString(KNOWN_TRUST_AGENTS, serializeTrustAgents(knownTrustAgents), userId); + } + + /** Returns the list of known trust agent in LockSettings storage for the given user. */ + public List<ComponentName> getKnownTrustAgents(int userId) { + return deserializeTrustAgents(getString(KNOWN_TRUST_AGENTS, userId)); + } + + private String serializeTrustAgents(Collection<ComponentName> trustAgents) { StringBuilder sb = new StringBuilder(); - for (ComponentName cn : activeTrustAgents) { + for (ComponentName cn : trustAgents) { if (sb.length() > 0) { sb.append(','); } sb.append(cn.flattenToShortString()); } - setString(ENABLED_TRUST_AGENTS, sb.toString(), userId); - getTrustManager().reportEnabledTrustAgentsChanged(userId); + return sb.toString(); } - public List<ComponentName> getEnabledTrustAgents(int userId) { - String serialized = getString(ENABLED_TRUST_AGENTS, userId); - if (TextUtils.isEmpty(serialized)) { - return new ArrayList<ComponentName>(); + private List<ComponentName> deserializeTrustAgents(String serializedTrustAgents) { + if (TextUtils.isEmpty(serializedTrustAgents)) { + return new ArrayList<>(); } - String[] split = serialized.split(","); - ArrayList<ComponentName> activeTrustAgents = new ArrayList<ComponentName>(split.length); + String[] split = serializedTrustAgents.split(","); + ArrayList<ComponentName> trustAgents = new ArrayList<>(split.length); for (String s : split) { if (!TextUtils.isEmpty(s)) { - activeTrustAgents.add(ComponentName.unflattenFromString(s)); + trustAgents.add(ComponentName.unflattenFromString(s)); } } - return activeTrustAgents; + return trustAgents; } /** @@ -1504,7 +1522,8 @@ public class LockPatternUtils { STRONG_AUTH_REQUIRED_AFTER_LOCKOUT, STRONG_AUTH_REQUIRED_AFTER_TIMEOUT, STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN, - STRONG_AUTH_REQUIRED_AFTER_NON_STRONG_BIOMETRICS_TIMEOUT}) + STRONG_AUTH_REQUIRED_AFTER_NON_STRONG_BIOMETRICS_TIMEOUT, + SOME_AUTH_REQUIRED_AFTER_TRUSTAGENT_EXPIRED}) @Retention(RetentionPolicy.SOURCE) public @interface StrongAuthFlags {} @@ -1557,6 +1576,12 @@ public class LockPatternUtils { public static final int STRONG_AUTH_REQUIRED_AFTER_NON_STRONG_BIOMETRICS_TIMEOUT = 0x80; /** + * Some authentication is required because the trustagent either timed out or was disabled + * manually. + */ + public static final int SOME_AUTH_REQUIRED_AFTER_TRUSTAGENT_EXPIRED = 0x100; + + /** * Strong auth flags that do not prevent biometric methods from being accepted as auth. * If any other flags are set, biometric authentication is disabled. */ |
