Merge "Parse persist property the legacy way"
diff --git a/api/current.txt b/api/current.txt
index ded0e43..5a3bc1a 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -11616,15 +11616,15 @@
 
   public final class AssetManager implements java.lang.AutoCloseable {
     method public void close();
-    method public java.lang.String[] getLocales();
-    method public java.lang.String[] list(java.lang.String) throws java.io.IOException;
-    method public java.io.InputStream open(java.lang.String) throws java.io.IOException;
-    method public java.io.InputStream open(java.lang.String, int) throws java.io.IOException;
-    method public android.content.res.AssetFileDescriptor openFd(java.lang.String) throws java.io.IOException;
-    method public android.content.res.AssetFileDescriptor openNonAssetFd(java.lang.String) throws java.io.IOException;
-    method public android.content.res.AssetFileDescriptor openNonAssetFd(int, java.lang.String) throws java.io.IOException;
-    method public android.content.res.XmlResourceParser openXmlResourceParser(java.lang.String) throws java.io.IOException;
-    method public android.content.res.XmlResourceParser openXmlResourceParser(int, java.lang.String) throws java.io.IOException;
+    method public final java.lang.String[] getLocales();
+    method public final java.lang.String[] list(java.lang.String) throws java.io.IOException;
+    method public final java.io.InputStream open(java.lang.String) throws java.io.IOException;
+    method public final java.io.InputStream open(java.lang.String, int) throws java.io.IOException;
+    method public final android.content.res.AssetFileDescriptor openFd(java.lang.String) throws java.io.IOException;
+    method public final android.content.res.AssetFileDescriptor openNonAssetFd(java.lang.String) throws java.io.IOException;
+    method public final android.content.res.AssetFileDescriptor openNonAssetFd(int, java.lang.String) throws java.io.IOException;
+    method public final android.content.res.XmlResourceParser openXmlResourceParser(java.lang.String) throws java.io.IOException;
+    method public final android.content.res.XmlResourceParser openXmlResourceParser(int, java.lang.String) throws java.io.IOException;
     field public static final int ACCESS_BUFFER = 3; // 0x3
     field public static final int ACCESS_RANDOM = 1; // 0x1
     field public static final int ACCESS_STREAMING = 2; // 0x2
diff --git a/api/system-current.txt b/api/system-current.txt
index 2d4c0ac..87269d0 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -822,8 +822,16 @@
     field public static final java.lang.String ACTION_USER_REMOVED = "android.intent.action.USER_REMOVED";
     field public static final java.lang.String ACTION_VOICE_ASSIST = "android.intent.action.VOICE_ASSIST";
     field public static final java.lang.String CATEGORY_LEANBACK_SETTINGS = "android.intent.category.LEANBACK_SETTINGS";
+    field public static final java.lang.String EXTRA_CALLING_PACKAGE = "android.intent.extra.CALLING_PACKAGE";
     field public static final java.lang.String EXTRA_FORCE_FACTORY_RESET = "android.intent.extra.FORCE_FACTORY_RESET";
+    field public static final java.lang.String EXTRA_INSTANT_APP_ACTION = "android.intent.extra.INSTANT_APP_ACTION";
     field public static final java.lang.String EXTRA_INSTANT_APP_BUNDLES = "android.intent.extra.INSTANT_APP_BUNDLES";
+    field public static final java.lang.String EXTRA_INSTANT_APP_EXTRAS = "android.intent.extra.INSTANT_APP_EXTRAS";
+    field public static final java.lang.String EXTRA_INSTANT_APP_FAILURE = "android.intent.extra.INSTANT_APP_FAILURE";
+    field public static final java.lang.String EXTRA_INSTANT_APP_HOSTNAME = "android.intent.extra.INSTANT_APP_HOSTNAME";
+    field public static final java.lang.String EXTRA_INSTANT_APP_SUCCESS = "android.intent.extra.INSTANT_APP_SUCCESS";
+    field public static final java.lang.String EXTRA_INSTANT_APP_TOKEN = "android.intent.extra.INSTANT_APP_TOKEN";
+    field public static final java.lang.String EXTRA_LONG_VERSION_CODE = "android.intent.extra.LONG_VERSION_CODE";
     field public static final java.lang.String EXTRA_ORIGINATING_UID = "android.intent.extra.ORIGINATING_UID";
     field public static final java.lang.String EXTRA_PACKAGES = "android.intent.extra.PACKAGES";
     field public static final java.lang.String EXTRA_PERMISSION_NAME = "android.intent.extra.PERMISSION_NAME";
@@ -831,6 +839,7 @@
     field public static final java.lang.String EXTRA_REMOTE_CALLBACK = "android.intent.extra.REMOTE_CALLBACK";
     field public static final java.lang.String EXTRA_RESULT_NEEDED = "android.intent.extra.RESULT_NEEDED";
     field public static final java.lang.String EXTRA_UNKNOWN_INSTANT_APP = "android.intent.extra.UNKNOWN_INSTANT_APP";
+    field public static final java.lang.String EXTRA_VERIFICATION_BUNDLE = "android.intent.extra.VERIFICATION_BUNDLE";
   }
 
   public class IntentFilter implements android.os.Parcelable {
@@ -843,7 +852,9 @@
 package android.content.pm {
 
   public class ApplicationInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
+    method public boolean isInstantApp();
     field public java.lang.String credentialProtectedDataDir;
+    field public int targetSandboxVersion;
   }
 
   public final class InstantAppInfo implements android.os.Parcelable {
diff --git a/api/system-removed.txt b/api/system-removed.txt
index b63703d..48f43e0 100644
--- a/api/system-removed.txt
+++ b/api/system-removed.txt
@@ -1,13 +1,5 @@
 package android.app {
 
-  public abstract deprecated class EphemeralResolverService extends android.app.InstantAppResolverService {
-    ctor public EphemeralResolverService();
-    method public android.os.Looper getLooper();
-    method public abstract deprecated java.util.List<android.content.pm.EphemeralResolveInfo> onEphemeralResolveInfoList(int[], int);
-    method public android.content.pm.EphemeralResolveInfo onGetEphemeralIntentFilter(java.lang.String);
-    method public java.util.List<android.content.pm.EphemeralResolveInfo> onGetEphemeralResolveInfo(int[]);
-  }
-
   public class Notification implements android.os.Parcelable {
     method public static java.lang.Class<? extends android.app.Notification.Style> getNotificationStyleClass(java.lang.String);
   }
@@ -31,10 +23,7 @@
 
   public class Intent implements java.lang.Cloneable android.os.Parcelable {
     field public static final deprecated java.lang.String ACTION_DEVICE_INITIALIZATION_WIZARD = "android.intent.action.DEVICE_INITIALIZATION_WIZARD";
-    field public static final deprecated java.lang.String ACTION_EPHEMERAL_RESOLVER_SETTINGS = "android.intent.action.EPHEMERAL_RESOLVER_SETTINGS";
-    field public static final deprecated java.lang.String ACTION_INSTALL_EPHEMERAL_PACKAGE = "android.intent.action.INSTALL_EPHEMERAL_PACKAGE";
     field public static final deprecated java.lang.String ACTION_MASTER_CLEAR = "android.intent.action.MASTER_CLEAR";
-    field public static final deprecated java.lang.String ACTION_RESOLVE_EPHEMERAL_PACKAGE = "android.intent.action.RESOLVE_EPHEMERAL_PACKAGE";
     field public static final deprecated java.lang.String ACTION_SERVICE_STATE = "android.intent.action.SERVICE_STATE";
     field public static final deprecated java.lang.String EXTRA_CDMA_DEFAULT_ROAMING_INDICATOR = "cdmaDefaultRoamingIndicator";
     field public static final deprecated java.lang.String EXTRA_CDMA_ROAMING_INDICATOR = "cdmaRoamingIndicator";
@@ -62,45 +51,6 @@
 
 }
 
-package android.content.pm {
-
-  public final deprecated class EphemeralIntentFilter implements android.os.Parcelable {
-    ctor public EphemeralIntentFilter(java.lang.String, java.util.List<android.content.IntentFilter>);
-    method public int describeContents();
-    method public java.util.List<android.content.IntentFilter> getFilters();
-    method public java.lang.String getSplitName();
-    method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.EphemeralIntentFilter> CREATOR;
-  }
-
-  public final deprecated class EphemeralResolveInfo implements android.os.Parcelable {
-    ctor public deprecated EphemeralResolveInfo(android.net.Uri, java.lang.String, java.util.List<android.content.IntentFilter>);
-    ctor public deprecated EphemeralResolveInfo(android.content.pm.EphemeralResolveInfo.EphemeralDigest, java.lang.String, java.util.List<android.content.pm.EphemeralIntentFilter>);
-    ctor public EphemeralResolveInfo(android.content.pm.EphemeralResolveInfo.EphemeralDigest, java.lang.String, java.util.List<android.content.pm.EphemeralIntentFilter>, int);
-    ctor public EphemeralResolveInfo(java.lang.String, java.lang.String, java.util.List<android.content.pm.EphemeralIntentFilter>);
-    method public int describeContents();
-    method public byte[] getDigestBytes();
-    method public int getDigestPrefix();
-    method public deprecated java.util.List<android.content.IntentFilter> getFilters();
-    method public java.util.List<android.content.pm.EphemeralIntentFilter> getIntentFilters();
-    method public java.lang.String getPackageName();
-    method public int getVersionCode();
-    method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.EphemeralResolveInfo> CREATOR;
-    field public static final java.lang.String SHA_ALGORITHM = "SHA-256";
-  }
-
-  public static final class EphemeralResolveInfo.EphemeralDigest implements android.os.Parcelable {
-    ctor public EphemeralResolveInfo.EphemeralDigest(java.lang.String);
-    method public int describeContents();
-    method public byte[][] getDigestBytes();
-    method public int[] getDigestPrefix();
-    method public void writeToParcel(android.os.Parcel, int);
-    field public static final android.os.Parcelable.Creator<android.content.pm.EphemeralResolveInfo.EphemeralDigest> CREATOR;
-  }
-
-}
-
 package android.media.tv {
 
   public final class TvInputManager {
diff --git a/core/java/android/app/EphemeralResolverService.java b/core/java/android/app/EphemeralResolverService.java
deleted file mode 100644
index d1c2441..0000000
--- a/core/java/android/app/EphemeralResolverService.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2015 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.app;
-
-import android.annotation.SystemApi;
-import android.content.pm.EphemeralResolveInfo;
-import android.content.pm.InstantAppResolveInfo;
-import android.os.Build;
-import android.os.Looper;
-import android.util.Log;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Base class for implementing the resolver service.
- * @hide
- * @removed
- * @deprecated use InstantAppResolverService instead
- */
-@Deprecated
-@SystemApi
-public abstract class EphemeralResolverService extends InstantAppResolverService {
-    private static final boolean DEBUG_EPHEMERAL = Build.IS_DEBUGGABLE;
-    private static final String TAG = "PackageManager";
-
-    /**
-     * Called to retrieve resolve info for ephemeral applications.
-     *
-     * @param digestPrefix The hash prefix of the ephemeral's domain.
-     * @param prefixMask A mask that was applied to each digest prefix. This should
-     *      be used when comparing against the digest prefixes as all bits might
-     *      not be set.
-     * @deprecated use {@link #onGetEphemeralResolveInfo(int[])} instead
-     */
-    @Deprecated
-    public abstract List<EphemeralResolveInfo> onEphemeralResolveInfoList(
-            int digestPrefix[], int prefix);
-
-    /**
-     * Called to retrieve resolve info for ephemeral applications.
-     *
-     * @param digestPrefix The hash prefix of the ephemeral's domain.
-     */
-    public List<EphemeralResolveInfo> onGetEphemeralResolveInfo(int digestPrefix[]) {
-        return onEphemeralResolveInfoList(digestPrefix, 0xFFFFF000);
-    }
-
-    /**
-     * Called to retrieve intent filters for ephemeral applications.
-     *
-     * @param hostName The name of the host to get intent filters for.
-     */
-    public EphemeralResolveInfo onGetEphemeralIntentFilter(String hostName) {
-        throw new IllegalStateException("Must define");
-    }
-
-    @Override
-    public Looper getLooper() {
-        return super.getLooper();
-    }
-
-    void _onGetInstantAppResolveInfo(int[] digestPrefix, String token,
-            InstantAppResolutionCallback callback) {
-        if (DEBUG_EPHEMERAL) {
-            Log.d(TAG, "Legacy resolver; getInstantAppResolveInfo;"
-                    + " prefix: " + Arrays.toString(digestPrefix));
-        }
-        final List<EphemeralResolveInfo> response = onGetEphemeralResolveInfo(digestPrefix);
-        final int responseSize = response == null ? 0 : response.size();
-        final List<InstantAppResolveInfo> resultList = new ArrayList<>(responseSize);
-        for (int i = 0; i < responseSize; i++) {
-            resultList.add(response.get(i).getInstantAppResolveInfo());
-        }
-        callback.onInstantAppResolveInfo(resultList);
-    }
-
-    void _onGetInstantAppIntentFilter(int[] digestPrefix, String token,
-            String hostName, InstantAppResolutionCallback callback) {
-        if (DEBUG_EPHEMERAL) {
-            Log.d(TAG, "Legacy resolver; getInstantAppIntentFilter;"
-                    + " prefix: " + Arrays.toString(digestPrefix));
-        }
-        final EphemeralResolveInfo response = onGetEphemeralIntentFilter(hostName);
-        final List<InstantAppResolveInfo> resultList = new ArrayList<>(1);
-        resultList.add(response.getInstantAppResolveInfo());
-        callback.onInstantAppResolveInfo(resultList);
-    }
-}
diff --git a/core/java/android/app/InstantAppResolverService.java b/core/java/android/app/InstantAppResolverService.java
index 89aff36..76a3682 100644
--- a/core/java/android/app/InstantAppResolverService.java
+++ b/core/java/android/app/InstantAppResolverService.java
@@ -43,7 +43,7 @@
  */
 @SystemApi
 public abstract class InstantAppResolverService extends Service {
-    private static final boolean DEBUG_EPHEMERAL = Build.IS_DEBUGGABLE;
+    private static final boolean DEBUG_INSTANT = Build.IS_DEBUGGABLE;
     private static final String TAG = "PackageManager";
 
     /** @hide */
@@ -133,7 +133,7 @@
             @Override
             public void getInstantAppResolveInfoList(Intent sanitizedIntent, int[] digestPrefix,
                     String token, int sequence, IRemoteCallback callback) {
-                if (DEBUG_EPHEMERAL) {
+                if (DEBUG_INSTANT) {
                     Slog.v(TAG, "[" + token + "] Phase1 called; posting");
                 }
                 final SomeArgs args = SomeArgs.obtain();
@@ -148,7 +148,7 @@
             @Override
             public void getInstantAppIntentFilterList(Intent sanitizedIntent,
                     int[] digestPrefix, String token, IRemoteCallback callback) {
-                if (DEBUG_EPHEMERAL) {
+                if (DEBUG_INSTANT) {
                     Slog.v(TAG, "[" + token + "] Phase2 called; posting");
                 }
                 final SomeArgs args = SomeArgs.obtain();
@@ -203,7 +203,7 @@
                     final String token = (String) args.arg3;
                     final Intent intent = (Intent) args.arg4;
                     final int sequence = message.arg1;
-                    if (DEBUG_EPHEMERAL) {
+                    if (DEBUG_INSTANT) {
                         Slog.d(TAG, "[" + token + "] Phase1 request;"
                                 + " prefix: " + Arrays.toString(digestPrefix));
                     }
@@ -217,7 +217,7 @@
                     final int[] digestPrefix = (int[]) args.arg2;
                     final String token = (String) args.arg3;
                     final Intent intent = (Intent) args.arg4;
-                    if (DEBUG_EPHEMERAL) {
+                    if (DEBUG_INSTANT) {
                         Slog.d(TAG, "[" + token + "] Phase2 request;"
                                 + " prefix: " + Arrays.toString(digestPrefix));
                     }
diff --git a/core/java/android/app/WindowConfiguration.java b/core/java/android/app/WindowConfiguration.java
index 085fc79..46566e7 100644
--- a/core/java/android/app/WindowConfiguration.java
+++ b/core/java/android/app/WindowConfiguration.java
@@ -146,6 +146,9 @@
     })
     public @interface WindowConfig {}
 
+    /** @hide */
+    public static final int PINNED_WINDOWING_MODE_ELEVATION_IN_DIP = 5;
+
     public WindowConfiguration() {
         unset();
     }
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index b3c8737..9b62f19 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -1554,16 +1554,6 @@
     public static final String ACTION_INSTALL_FAILURE = "android.intent.action.INSTALL_FAILURE";
 
     /**
-     * @hide
-     * @removed
-     * @deprecated Do not use. This will go away.
-     *     Replace with {@link #ACTION_INSTALL_INSTANT_APP_PACKAGE}.
-     */
-    @SystemApi
-    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
-    public static final String ACTION_INSTALL_EPHEMERAL_PACKAGE
-            = "android.intent.action.INSTALL_EPHEMERAL_PACKAGE";
-    /**
      * Activity Action: Launch instant application installer.
      * <p class="note">
      * This is a protected intent that can only be sent by the system.
@@ -1577,16 +1567,6 @@
             = "android.intent.action.INSTALL_INSTANT_APP_PACKAGE";
 
     /**
-     * @hide
-     * @removed
-     * @deprecated Do not use. This will go away.
-     *     Replace with {@link #ACTION_RESOLVE_INSTANT_APP_PACKAGE}.
-     */
-    @SystemApi
-    @SdkConstant(SdkConstantType.SERVICE_ACTION)
-    public static final String ACTION_RESOLVE_EPHEMERAL_PACKAGE
-            = "android.intent.action.RESOLVE_EPHEMERAL_PACKAGE";
-    /**
      * Service Action: Resolve instant application.
      * <p>
      * The system will have a persistent connection to this service.
@@ -1601,16 +1581,6 @@
             = "android.intent.action.RESOLVE_INSTANT_APP_PACKAGE";
 
     /**
-     * @hide
-     * @removed
-     * @deprecated Do not use. This will go away.
-     *     Replace with {@link #ACTION_INSTANT_APP_RESOLVER_SETTINGS}.
-     */
-    @SystemApi
-    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
-    public static final String ACTION_EPHEMERAL_RESOLVER_SETTINGS
-            = "android.intent.action.EPHEMERAL_RESOLVER_SETTINGS";
-    /**
      * Activity Action: Launch instant app settings.
      *
      * <p class="note">
@@ -4444,32 +4414,77 @@
 
     /**
      * A {@link IntentSender} to start after ephemeral installation success.
+     * @deprecated Use {@link #EXTRA_INSTANT_APP_SUCCESS).
+     * @removed
      * @hide
      */
+    @Deprecated
     public static final String EXTRA_EPHEMERAL_SUCCESS = "android.intent.extra.EPHEMERAL_SUCCESS";
 
     /**
-     * A {@link IntentSender} to start after ephemeral installation failure.
+     * A {@link IntentSender} to start after instant app installation success.
      * @hide
      */
+    @SystemApi
+    public static final String EXTRA_INSTANT_APP_SUCCESS =
+            "android.intent.extra.INSTANT_APP_SUCCESS";
+
+    /**
+     * A {@link IntentSender} to start after ephemeral installation failure.
+     * @deprecated Use {@link #EXTRA_INSTANT_APP_FAILURE).
+     * @removed
+     * @hide
+     */
+    @Deprecated
     public static final String EXTRA_EPHEMERAL_FAILURE = "android.intent.extra.EPHEMERAL_FAILURE";
 
     /**
-     * The host name that triggered an ephemeral resolution.
+     * A {@link IntentSender} to start after instant app installation failure.
      * @hide
      */
+    @SystemApi
+    public static final String EXTRA_INSTANT_APP_FAILURE =
+            "android.intent.extra.INSTANT_APP_FAILURE";
+
+    /**
+     * The host name that triggered an ephemeral resolution.
+     * @deprecated Use {@link #EXTRA_INSTANT_APP_HOSTNAME).
+     * @removed
+     * @hide
+     */
+    @Deprecated
     public static final String EXTRA_EPHEMERAL_HOSTNAME = "android.intent.extra.EPHEMERAL_HOSTNAME";
 
     /**
-     * An opaque token to track ephemeral resolution.
+     * The host name that triggered an instant app resolution.
      * @hide
      */
+    @SystemApi
+    public static final String EXTRA_INSTANT_APP_HOSTNAME =
+            "android.intent.extra.INSTANT_APP_HOSTNAME";
+
+    /**
+     * An opaque token to track ephemeral resolution.
+     * @deprecated Use {@link #EXTRA_INSTANT_APP_TOKEN).
+     * @removed
+     * @hide
+     */
+    @Deprecated
     public static final String EXTRA_EPHEMERAL_TOKEN = "android.intent.extra.EPHEMERAL_TOKEN";
 
     /**
+     * An opaque token to track instant app resolution.
+     * @hide
+     */
+    @SystemApi
+    public static final String EXTRA_INSTANT_APP_TOKEN =
+            "android.intent.extra.INSTANT_APP_TOKEN";
+
+    /**
      * The action that triggered an instant application resolution.
      * @hide
      */
+    @SystemApi
     public static final String EXTRA_INSTANT_APP_ACTION = "android.intent.extra.INSTANT_APP_ACTION";
 
     /**
@@ -4487,6 +4502,7 @@
      * instant application resolver.
      * @hide
      */
+    @SystemApi
     public static final String EXTRA_INSTANT_APP_EXTRAS =
             "android.intent.extra.INSTANT_APP_EXTRAS";
 
@@ -4512,12 +4528,14 @@
      * The version code of the app to install components from.
      * @hide
      */
+    @SystemApi
     public static final String EXTRA_LONG_VERSION_CODE = "android.intent.extra.LONG_VERSION_CODE";
 
     /**
-     * The app that triggered the ephemeral installation.
+     * The app that triggered the instant app installation.
      * @hide
      */
+    @SystemApi
     public static final String EXTRA_CALLING_PACKAGE
             = "android.intent.extra.CALLING_PACKAGE";
 
@@ -4526,6 +4544,7 @@
      * installer may use.
      * @hide
      */
+    @SystemApi
     public static final String EXTRA_VERIFICATION_BUNDLE
             = "android.intent.extra.VERIFICATION_BUNDLE";
 
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index f6697e8..db1630b 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -958,6 +958,7 @@
      * Version of the sandbox the application wants to run in.
      * @hide
      */
+    @SystemApi
     public int targetSandboxVersion;
 
     /**
@@ -1655,7 +1656,11 @@
         return (privateFlags & ApplicationInfo.PRIVATE_FLAG_FORWARD_LOCK) != 0;
     }
 
-    /** @hide */
+    /**
+     * True if the application is installed as an instant app.
+     * @hide
+     */
+    @SystemApi
     public boolean isInstantApp() {
         return (privateFlags & ApplicationInfo.PRIVATE_FLAG_INSTANT) != 0;
     }
diff --git a/core/java/android/content/pm/EphemeralIntentFilter.java b/core/java/android/content/pm/EphemeralIntentFilter.java
deleted file mode 100644
index 1dbbf81..0000000
--- a/core/java/android/content/pm/EphemeralIntentFilter.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2016 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.content.pm;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.annotation.SystemApi;
-import android.content.IntentFilter;
-import android.os.Parcel;
-import android.os.Parcelable;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Information about an ephemeral application intent filter.
- * @hide
- * @removed
- */
-@Deprecated
-@SystemApi
-public final class EphemeralIntentFilter implements Parcelable {
-    private final InstantAppIntentFilter mInstantAppIntentFilter;
-
-    public EphemeralIntentFilter(@Nullable String splitName, @NonNull List<IntentFilter> filters) {
-        mInstantAppIntentFilter = new InstantAppIntentFilter(splitName, filters);
-    }
-
-    EphemeralIntentFilter(@NonNull InstantAppIntentFilter intentFilter) {
-        mInstantAppIntentFilter = intentFilter;
-    }
-
-    EphemeralIntentFilter(Parcel in) {
-        mInstantAppIntentFilter = in.readParcelable(null /*loader*/);
-    }
-
-    public String getSplitName() {
-        return mInstantAppIntentFilter.getSplitName();
-    }
-
-    public List<IntentFilter> getFilters() {
-        return mInstantAppIntentFilter.getFilters();
-    }
-
-    /** @hide */
-    InstantAppIntentFilter getInstantAppIntentFilter() {
-        return mInstantAppIntentFilter;
-    }
-
-    @Override
-    public int describeContents() {
-        return 0;
-    }
-
-    @Override
-    public void writeToParcel(Parcel out, int flags) {
-        out.writeParcelable(mInstantAppIntentFilter, flags);
-    }
-
-    public static final Parcelable.Creator<EphemeralIntentFilter> CREATOR
-            = new Parcelable.Creator<EphemeralIntentFilter>() {
-        @Override
-        public EphemeralIntentFilter createFromParcel(Parcel in) {
-            return new EphemeralIntentFilter(in);
-        }
-        @Override
-        public EphemeralIntentFilter[] newArray(int size) {
-            return new EphemeralIntentFilter[size];
-        }
-    };
-}
diff --git a/core/java/android/content/pm/EphemeralResolveInfo.java b/core/java/android/content/pm/EphemeralResolveInfo.java
deleted file mode 100644
index 12131a3..0000000
--- a/core/java/android/content/pm/EphemeralResolveInfo.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Copyright (C) 2015 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.content.pm;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.annotation.SystemApi;
-import android.content.IntentFilter;
-import android.content.pm.InstantAppResolveInfo.InstantAppDigest;
-import android.net.Uri;
-import android.os.Parcel;
-import android.os.Parcelable;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-
-/**
- * Information about an ephemeral application.
- * @hide
- * @removed
- */
-@Deprecated
-@SystemApi
-public final class EphemeralResolveInfo implements Parcelable {
-    /** Algorithm that will be used to generate the domain digest */
-    public static final String SHA_ALGORITHM = "SHA-256";
-
-    private final InstantAppResolveInfo mInstantAppResolveInfo;
-    @Deprecated
-    private final List<IntentFilter> mLegacyFilters;
-
-    @Deprecated
-    public EphemeralResolveInfo(@NonNull Uri uri, @NonNull String packageName,
-            @NonNull List<IntentFilter> filters) {
-        if (uri == null || packageName == null || filters == null || filters.isEmpty()) {
-            throw new IllegalArgumentException();
-        }
-        final List<EphemeralIntentFilter> ephemeralFilters = new ArrayList<>(1);
-        ephemeralFilters.add(new EphemeralIntentFilter(packageName, filters));
-        mInstantAppResolveInfo = new InstantAppResolveInfo(uri.getHost(), packageName,
-                createInstantAppIntentFilterList(ephemeralFilters));
-        mLegacyFilters = new ArrayList<IntentFilter>(filters.size());
-        mLegacyFilters.addAll(filters);
-    }
-
-    @Deprecated
-    public EphemeralResolveInfo(@NonNull EphemeralDigest digest, @Nullable String packageName,
-            @Nullable List<EphemeralIntentFilter> filters) {
-        this(digest, packageName, filters, -1 /*versionCode*/);
-    }
-
-    public EphemeralResolveInfo(@NonNull EphemeralDigest digest, @Nullable String packageName,
-            @Nullable List<EphemeralIntentFilter> filters, int versionCode) {
-        mInstantAppResolveInfo = new InstantAppResolveInfo(
-                digest.getInstantAppDigest(), packageName,
-                createInstantAppIntentFilterList(filters), versionCode);
-        mLegacyFilters = null;
-    }
-
-    public EphemeralResolveInfo(@NonNull String hostName, @Nullable String packageName,
-            @Nullable List<EphemeralIntentFilter> filters) {
-        this(new EphemeralDigest(hostName), packageName, filters);
-    }
-
-    EphemeralResolveInfo(Parcel in) {
-        mInstantAppResolveInfo = in.readParcelable(null /*loader*/);
-        mLegacyFilters = new ArrayList<IntentFilter>();
-        in.readList(mLegacyFilters, null /*loader*/);
-    }
-
-    /** @hide */
-    public InstantAppResolveInfo getInstantAppResolveInfo() {
-        return mInstantAppResolveInfo;
-    }
-
-    private static List<InstantAppIntentFilter> createInstantAppIntentFilterList(
-            List<EphemeralIntentFilter> filters) {
-        if (filters == null) {
-            return null;
-        }
-        final int filterCount = filters.size();
-        final List<InstantAppIntentFilter> returnList = new ArrayList<>(filterCount);
-        for (int i = 0; i < filterCount; i++) {
-            returnList.add(filters.get(i).getInstantAppIntentFilter());
-        }
-        return returnList;
-    }
-
-    public byte[] getDigestBytes() {
-        return mInstantAppResolveInfo.getDigestBytes();
-    }
-
-    public int getDigestPrefix() {
-        return mInstantAppResolveInfo.getDigestPrefix();
-    }
-
-    public String getPackageName() {
-        return mInstantAppResolveInfo.getPackageName();
-    }
-
-    public List<EphemeralIntentFilter> getIntentFilters() {
-        final List<InstantAppIntentFilter> filters = mInstantAppResolveInfo.getIntentFilters();
-        final int filterCount = filters.size();
-        final List<EphemeralIntentFilter> returnList = new ArrayList<>(filterCount);
-        for (int i = 0; i < filterCount; i++) {
-            returnList.add(new EphemeralIntentFilter(filters.get(i)));
-        }
-        return returnList;
-    }
-
-    public int getVersionCode() {
-        return mInstantAppResolveInfo.getVersionCode();
-    }
-
-    @Deprecated
-    public List<IntentFilter> getFilters() {
-        return mLegacyFilters;
-    }
-
-    @Override
-    public int describeContents() {
-        return 0;
-    }
-
-    @Override
-    public void writeToParcel(Parcel out, int flags) {
-        out.writeParcelable(mInstantAppResolveInfo, flags);
-        out.writeList(mLegacyFilters);
-    }
-
-    public static final Parcelable.Creator<EphemeralResolveInfo> CREATOR
-            = new Parcelable.Creator<EphemeralResolveInfo>() {
-        @Override
-        public EphemeralResolveInfo createFromParcel(Parcel in) {
-            return new EphemeralResolveInfo(in);
-        }
-        @Override
-        public EphemeralResolveInfo[] newArray(int size) {
-            return new EphemeralResolveInfo[size];
-        }
-    };
-
-    /**
-     * Helper class to generate and store each of the digests and prefixes
-     * sent to the Ephemeral Resolver.
-     * <p>
-     * Since intent filters may want to handle multiple hosts within a
-     * domain [eg “*.google.com”], the resolver is presented with multiple
-     * hash prefixes. For example, "a.b.c.d.e" generates digests for
-     * "d.e", "c.d.e", "b.c.d.e" and "a.b.c.d.e".
-     *
-     * @hide
-     */
-    @SystemApi
-    public static final class EphemeralDigest implements Parcelable {
-        private final InstantAppDigest mInstantAppDigest;
-
-        public EphemeralDigest(@NonNull String hostName) {
-            this(hostName, -1 /*maxDigests*/);
-        }
-
-        /** @hide */
-        public EphemeralDigest(@NonNull String hostName, int maxDigests) {
-            mInstantAppDigest = new InstantAppDigest(hostName, maxDigests);
-        }
-
-        EphemeralDigest(Parcel in) {
-            mInstantAppDigest = in.readParcelable(null /*loader*/);
-        }
-
-        /** @hide */
-        InstantAppDigest getInstantAppDigest() {
-            return mInstantAppDigest;
-        }
-
-        public byte[][] getDigestBytes() {
-            return mInstantAppDigest.getDigestBytes();
-        }
-
-        public int[] getDigestPrefix() {
-            return mInstantAppDigest.getDigestPrefix();
-        }
-
-        @Override
-        public int describeContents() {
-            return 0;
-        }
-
-        @Override
-        public void writeToParcel(Parcel out, int flags) {
-            out.writeParcelable(mInstantAppDigest, flags);
-        }
-
-        @SuppressWarnings("hiding")
-        public static final Parcelable.Creator<EphemeralDigest> CREATOR =
-                new Parcelable.Creator<EphemeralDigest>() {
-            @Override
-            public EphemeralDigest createFromParcel(Parcel in) {
-                return new EphemeralDigest(in);
-            }
-            @Override
-            public EphemeralDigest[] newArray(int size) {
-                return new EphemeralDigest[size];
-            }
-        };
-    }
-}
diff --git a/core/java/android/net/IpSecTransform.java b/core/java/android/net/IpSecTransform.java
index 9ccdbe2..0829b4a 100644
--- a/core/java/android/net/IpSecTransform.java
+++ b/core/java/android/net/IpSecTransform.java
@@ -462,7 +462,7 @@
             mConfig.setMode(MODE_TUNNEL);
             mConfig.setSourceAddress(sourceAddress.getHostAddress());
             mConfig.setSpiResourceId(spi.getResourceId());
-            return new IpSecTransform(mContext, mConfig);
+            return new IpSecTransform(mContext, mConfig).activate();
         }
 
         /**
diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java
index 95bc352..eadefc9 100644
--- a/core/java/com/android/internal/policy/DecorView.java
+++ b/core/java/com/android/internal/policy/DecorView.java
@@ -86,6 +86,7 @@
 import android.widget.FrameLayout;
 import android.widget.PopupWindow;
 
+import static android.app.WindowConfiguration.PINNED_WINDOWING_MODE_ELEVATION_IN_DIP;
 import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
 import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
 import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
@@ -2216,7 +2217,7 @@
             elevation = dipToPx(elevation);
             mElevationAdjustedForStack = true;
         } else if (windowingMode == WINDOWING_MODE_PINNED) {
-            elevation = dipToPx(DECOR_SHADOW_UNFOCUSED_HEIGHT_IN_DIP);
+            elevation = dipToPx(PINNED_WINDOWING_MODE_ELEVATION_IN_DIP);
             mElevationAdjustedForStack = true;
         } else {
             mElevationAdjustedForStack = false;
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index f3c3c47..d202173 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -766,18 +766,17 @@
 
     /*
      * Enable debugging only for apps forked from zygote.
-     * Set suspend=y to pause during VM init and use android ADB transport.
      */
     if (zygote) {
+      // Set the JDWP provider and required arguments. By default let the runtime choose how JDWP is
+      // implemented. When this is not set the runtime defaults to not allowing JDWP.
       addOption("-XjdwpOptions:suspend=n,server=y");
+      parseRuntimeOption("dalvik.vm.jdwp-provider",
+                         jdwpProviderBuf,
+                         "-XjdwpProvider:",
+                         "default");
     }
 
-    // Set the JDWP provider. By default let the runtime choose.
-    parseRuntimeOption("dalvik.vm.jdwp-provider",
-                       jdwpProviderBuf,
-                       "-XjdwpProvider:",
-                       "default");
-
     parseRuntimeOption("dalvik.vm.lockprof.threshold",
                        lockProfThresholdBuf,
                        "-Xlockprofthreshold:");
diff --git a/services/core/java/com/android/server/IpSecService.java b/services/core/java/com/android/server/IpSecService.java
index fe4ac6d7..a07a982 100644
--- a/services/core/java/com/android/server/IpSecService.java
+++ b/services/core/java/com/android/server/IpSecService.java
@@ -87,6 +87,7 @@
     private static final String NETD_SERVICE_NAME = "netd";
     private static final int[] DIRECTIONS =
             new int[] {IpSecManager.DIRECTION_OUT, IpSecManager.DIRECTION_IN};
+    private static final String[] WILDCARD_ADDRESSES = new String[]{"0.0.0.0", "::"};
 
     private static final int NETD_FETCH_TIMEOUT_MS = 5000; // ms
     private static final int MAX_PORT_BIND_ATTEMPTS = 10;
@@ -413,12 +414,16 @@
                     .append(mTransformQuotaTracker)
                     .append(", mSocketQuotaTracker=")
                     .append(mSocketQuotaTracker)
+                    .append(", mTunnelQuotaTracker=")
+                    .append(mTunnelQuotaTracker)
                     .append(", mSpiRecords=")
                     .append(mSpiRecords)
                     .append(", mTransformRecords=")
                     .append(mTransformRecords)
                     .append(", mEncapSocketRecords=")
                     .append(mEncapSocketRecords)
+                    .append(", mTunnelInterfaceRecords=")
+                    .append(mTunnelInterfaceRecords)
                     .append("}")
                     .toString();
         }
@@ -815,12 +820,14 @@
             try {
                 mSrvConfig.getNetdInstance().removeVirtualTunnelInterface(mInterfaceName);
 
-                for (int direction : DIRECTIONS) {
-                    int mark = (direction == IpSecManager.DIRECTION_IN) ? mIkey : mOkey;
-                    mSrvConfig
-                            .getNetdInstance()
-                            .ipSecDeleteSecurityPolicy(
-                                    0, direction, mLocalAddress, mRemoteAddress, mark, 0xffffffff);
+                for(String wildcardAddr : WILDCARD_ADDRESSES) {
+                    for (int direction : DIRECTIONS) {
+                        int mark = (direction == IpSecManager.DIRECTION_IN) ? mIkey : mOkey;
+                        mSrvConfig
+                                .getNetdInstance()
+                                .ipSecDeleteSecurityPolicy(
+                                        0, direction, wildcardAddr, wildcardAddr, mark, 0xffffffff);
+                    }
                 }
             } catch (ServiceSpecificException e) {
                 // FIXME: get the error code and throw is at an IOException from Errno Exception
@@ -1261,19 +1268,21 @@
                     .getNetdInstance()
                     .addVirtualTunnelInterface(intfName, localAddr, remoteAddr, ikey, okey);
 
-            for (int direction : DIRECTIONS) {
-                int mark = (direction == IpSecManager.DIRECTION_OUT) ? okey : ikey;
+            for(String wildcardAddr : WILDCARD_ADDRESSES) {
+                for (int direction : DIRECTIONS) {
+                    int mark = (direction == IpSecManager.DIRECTION_OUT) ? okey : ikey;
 
-                mSrvConfig
-                        .getNetdInstance()
-                        .ipSecAddSecurityPolicy(
+                    mSrvConfig
+                            .getNetdInstance()
+                            .ipSecAddSecurityPolicy(
                                 0, // Use 0 for reqId
                                 direction,
-                                "",
-                                "",
+                                wildcardAddr,
+                                wildcardAddr,
                                 0,
                                 mark,
                                 0xffffffff);
+                }
             }
 
             userRecord.mTunnelInterfaceRecords.put(
@@ -1646,16 +1655,18 @@
                 c.setNetwork(tunnelInterfaceInfo.getUnderlyingNetwork());
 
                 // If outbound, also add SPI to the policy.
-                mSrvConfig
-                        .getNetdInstance()
-                        .ipSecUpdateSecurityPolicy(
-                                0, // Use 0 for reqId
-                                direction,
-                                "",
-                                "",
-                                transformInfo.getSpiRecord().getSpi(),
-                                mark,
-                                0xffffffff);
+                for(String wildcardAddr : WILDCARD_ADDRESSES) {
+                    mSrvConfig
+                            .getNetdInstance()
+                            .ipSecUpdateSecurityPolicy(
+                                    0, // Use 0 for reqId
+                                    direction,
+                                    wildcardAddr,
+                                    wildcardAddr,
+                                    transformInfo.getSpiRecord().getSpi(),
+                                    mark,
+                                    0xffffffff);
+                }
             }
 
             // Update SA with tunnel mark (ikey or okey based on direction)
diff --git a/services/core/java/com/android/server/pm/InstantAppResolver.java b/services/core/java/com/android/server/pm/InstantAppResolver.java
index 55212cc..af446ba 100644
--- a/services/core/java/com/android/server/pm/InstantAppResolver.java
+++ b/services/core/java/com/android/server/pm/InstantAppResolver.java
@@ -51,8 +51,8 @@
 
 import com.android.internal.logging.MetricsLogger;
 import com.android.internal.logging.nano.MetricsProto;
-import com.android.server.pm.EphemeralResolverConnection.ConnectionException;
-import com.android.server.pm.EphemeralResolverConnection.PhaseTwoCallback;
+import com.android.server.pm.InstantAppResolverConnection.ConnectionException;
+import com.android.server.pm.InstantAppResolverConnection.PhaseTwoCallback;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -66,7 +66,7 @@
 
 /** @hide */
 public abstract class InstantAppResolver {
-    private static final boolean DEBUG_EPHEMERAL = Build.IS_DEBUGGABLE;
+    private static final boolean DEBUG_INSTANT = Build.IS_DEBUGGABLE;
     private static final String TAG = "PackageManager";
 
     private static final int RESOLUTION_SUCCESS = 0;
@@ -117,10 +117,10 @@
     }
 
     public static AuxiliaryResolveInfo doInstantAppResolutionPhaseOne(
-            EphemeralResolverConnection connection, InstantAppRequest requestObj) {
+            InstantAppResolverConnection connection, InstantAppRequest requestObj) {
         final long startTime = System.currentTimeMillis();
         final String token = UUID.randomUUID().toString();
-        if (DEBUG_EPHEMERAL) {
+        if (DEBUG_INSTANT) {
             Log.d(TAG, "[" + token + "] Phase1; resolving");
         }
         final Intent origIntent = requestObj.origIntent;
@@ -152,7 +152,7 @@
             logMetrics(ACTION_INSTANT_APP_RESOLUTION_PHASE_ONE, startTime, token,
                     resolutionStatus);
         }
-        if (DEBUG_EPHEMERAL && resolveInfo == null) {
+        if (DEBUG_INSTANT && resolveInfo == null) {
             if (resolutionStatus == RESOLUTION_BIND_TIMEOUT) {
                 Log.d(TAG, "[" + token + "] Phase1; bind timed out");
             } else if (resolutionStatus == RESOLUTION_CALL_TIMEOUT) {
@@ -173,11 +173,11 @@
     }
 
     public static void doInstantAppResolutionPhaseTwo(Context context,
-            EphemeralResolverConnection connection, InstantAppRequest requestObj,
+            InstantAppResolverConnection connection, InstantAppRequest requestObj,
             ActivityInfo instantAppInstaller, Handler callbackHandler) {
         final long startTime = System.currentTimeMillis();
         final String token = requestObj.responseObj.token;
-        if (DEBUG_EPHEMERAL) {
+        if (DEBUG_INSTANT) {
             Log.d(TAG, "[" + token + "] Phase2; resolving");
         }
         final Intent origIntent = requestObj.origIntent;
@@ -234,7 +234,7 @@
             }
             logMetrics(ACTION_INSTANT_APP_RESOLUTION_PHASE_TWO, startTime, token,
                     resolutionStatus);
-            if (DEBUG_EPHEMERAL) {
+            if (DEBUG_INSTANT) {
                 if (resolutionStatus == RESOLUTION_BIND_TIMEOUT) {
                     Log.d(TAG, "[" + token + "] Phase2; bind timed out");
                 } else {
@@ -268,10 +268,14 @@
                 | Intent.FLAG_ACTIVITY_NO_HISTORY
                 | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
         if (token != null) {
+            // TODO(b/72700831): remove populating old extra
             intent.putExtra(Intent.EXTRA_EPHEMERAL_TOKEN, token);
+            intent.putExtra(Intent.EXTRA_INSTANT_APP_TOKEN, token);
         }
         if (origIntent.getData() != null) {
+            // TODO(b/72700831): remove populating old extra
             intent.putExtra(Intent.EXTRA_EPHEMERAL_HOSTNAME, origIntent.getData().getHost());
+            intent.putExtra(Intent.EXTRA_INSTANT_APP_HOSTNAME, origIntent.getData().getHost());
         }
         intent.putExtra(Intent.EXTRA_INSTANT_APP_ACTION, origIntent.getAction());
         intent.putExtra(Intent.EXTRA_INTENT, sanitizedIntent);
@@ -305,8 +309,10 @@
                                             | PendingIntent.FLAG_ONE_SHOT
                                             | PendingIntent.FLAG_IMMUTABLE,
                                     null /*bOptions*/, userId);
-                    intent.putExtra(Intent.EXTRA_EPHEMERAL_FAILURE,
-                            new IntentSender(failureIntentTarget));
+                    IntentSender failureSender = new IntentSender(failureIntentTarget);
+                    // TODO(b/72700831): remove populating old extra
+                    intent.putExtra(Intent.EXTRA_EPHEMERAL_FAILURE, failureSender);
+                    intent.putExtra(Intent.EXTRA_INSTANT_APP_FAILURE, failureSender);
                 } catch (RemoteException ignore) { /* ignore; same process */ }
             }
 
@@ -323,8 +329,10 @@
                                 PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_ONE_SHOT
                                         | PendingIntent.FLAG_IMMUTABLE,
                                 null /*bOptions*/, userId);
-                intent.putExtra(Intent.EXTRA_EPHEMERAL_SUCCESS,
-                        new IntentSender(successIntentTarget));
+                IntentSender successSender = new IntentSender(successIntentTarget);
+                // TODO(b/72700831): remove populating old extra
+                intent.putExtra(Intent.EXTRA_EPHEMERAL_SUCCESS, successSender);
+                intent.putExtra(Intent.EXTRA_INSTANT_APP_SUCCESS, successSender);
             } catch (RemoteException ignore) { /* ignore; same process */ }
             if (verificationBundle != null) {
                 intent.putExtra(Intent.EXTRA_VERIFICATION_BUNDLE, verificationBundle);
@@ -444,13 +452,13 @@
                 return null;
             }
             // No filters; we need to start phase two
-            if (DEBUG_EPHEMERAL) {
+            if (DEBUG_INSTANT) {
                 Log.d(TAG, "No app filters; go to phase 2");
             }
             return Collections.emptyList();
         }
-        final PackageManagerService.EphemeralIntentResolver instantAppResolver =
-                new PackageManagerService.EphemeralIntentResolver();
+        final PackageManagerService.InstantAppIntentResolver instantAppResolver =
+                new PackageManagerService.InstantAppIntentResolver();
         for (int j = instantAppFilters.size() - 1; j >= 0; --j) {
             final InstantAppIntentFilter instantAppFilter = instantAppFilters.get(j);
             final List<IntentFilter> splitFilters = instantAppFilter.getFilters();
@@ -481,11 +489,11 @@
                 instantAppResolver.queryIntent(
                         origIntent, resolvedType, false /*defaultOnly*/, userId);
         if (!matchedResolveInfoList.isEmpty()) {
-            if (DEBUG_EPHEMERAL) {
+            if (DEBUG_INSTANT) {
                 Log.d(TAG, "[" + token + "] Found match(es); " + matchedResolveInfoList);
             }
             return matchedResolveInfoList;
-        } else if (DEBUG_EPHEMERAL) {
+        } else if (DEBUG_INSTANT) {
             Log.d(TAG, "[" + token + "] No matches found"
                     + " package: " + instantAppInfo.getPackageName()
                     + ", versionCode: " + instantAppInfo.getVersionCode());
diff --git a/services/core/java/com/android/server/pm/EphemeralResolverConnection.java b/services/core/java/com/android/server/pm/InstantAppResolverConnection.java
similarity index 90%
rename from services/core/java/com/android/server/pm/EphemeralResolverConnection.java
rename to services/core/java/com/android/server/pm/InstantAppResolverConnection.java
index 6d6c960..a9ee411 100644
--- a/services/core/java/com/android/server/pm/EphemeralResolverConnection.java
+++ b/services/core/java/com/android/server/pm/InstantAppResolverConnection.java
@@ -37,34 +37,29 @@
 import android.util.TimedRemoteCaller;
 
 import com.android.internal.annotations.GuardedBy;
-import com.android.internal.os.TransferPipe;
 
-import java.io.FileDescriptor;
-import java.io.IOException;
-import java.io.PrintWriter;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 import java.util.NoSuchElementException;
 import java.util.concurrent.TimeoutException;
 
 /**
- * Represents a remote ephemeral resolver. It is responsible for binding to the remote
+ * Represents a remote instant app resolver. It is responsible for binding to the remote
  * service and handling all interactions in a timely manner.
  * @hide
  */
-final class EphemeralResolverConnection implements DeathRecipient {
+final class InstantAppResolverConnection implements DeathRecipient {
     private static final String TAG = "PackageManager";
     // This is running in a critical section and the timeout must be sufficiently low
     private static final long BIND_SERVICE_TIMEOUT_MS =
             Build.IS_ENG ? 500 : 300;
     private static final long CALL_SERVICE_TIMEOUT_MS =
             Build.IS_ENG ? 200 : 100;
-    private static final boolean DEBUG_EPHEMERAL = Build.IS_DEBUGGABLE;
+    private static final boolean DEBUG_INSTANT = Build.IS_DEBUGGABLE;
 
     private final Object mLock = new Object();
-    private final GetEphemeralResolveInfoCaller mGetEphemeralResolveInfoCaller =
-            new GetEphemeralResolveInfoCaller();
+    private final GetInstantAppResolveInfoCaller mGetInstantAppResolveInfoCaller =
+            new GetInstantAppResolveInfoCaller();
     private final ServiceConnection mServiceConnection = new MyServiceConnection();
     private final Context mContext;
     /** Intent used to bind to the service */
@@ -79,7 +74,7 @@
     @GuardedBy("mLock")
     private IInstantAppResolver mRemoteInstance;
 
-    public EphemeralResolverConnection(
+    public InstantAppResolverConnection(
             Context context, ComponentName componentName, String action) {
         mContext = context;
         mIntent = new Intent(action).setComponent(componentName);
@@ -98,8 +93,8 @@
                 throw new ConnectionException(ConnectionException.FAILURE_INTERRUPTED);
             }
             try {
-                return mGetEphemeralResolveInfoCaller
-                        .getEphemeralResolveInfoList(target, sanitizedIntent, hashPrefix, token);
+                return mGetInstantAppResolveInfoCaller
+                        .getInstantAppResolveInfoList(target, sanitizedIntent, hashPrefix, token);
             } catch (TimeoutException e) {
                 throw new ConnectionException(ConnectionException.FAILURE_CALL);
             } catch (RemoteException ignore) {
@@ -171,7 +166,7 @@
 
             if (mBindState == STATE_PENDING) {
                 // there is a pending bind, let's see if we can use it.
-                if (DEBUG_EPHEMERAL) {
+                if (DEBUG_INSTANT) {
                     Slog.i(TAG, "[" + token + "] Previous bind timed out; waiting for connection");
                 }
                 try {
@@ -188,7 +183,7 @@
             if (mBindState == STATE_BINDING) {
                 // someone was binding when we called bind(), or they raced ahead while we were
                 // waiting in the PENDING case; wait for their result instead. Last chance!
-                if (DEBUG_EPHEMERAL) {
+                if (DEBUG_INSTANT) {
                     Slog.i(TAG, "[" + token + "] Another thread is binding; waiting for connection");
                 }
                 waitForBindLocked(token);
@@ -206,12 +201,12 @@
         IInstantAppResolver instance = null;
         try {
             if (doUnbind) {
-                if (DEBUG_EPHEMERAL) {
+                if (DEBUG_INSTANT) {
                     Slog.i(TAG, "[" + token + "] Previous connection never established; rebinding");
                 }
                 mContext.unbindService(mServiceConnection);
             }
-            if (DEBUG_EPHEMERAL) {
+            if (DEBUG_INSTANT) {
                 Slog.v(TAG, "[" + token + "] Binding to instant app resolver");
             }
             final int flags = Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE;
@@ -247,7 +242,7 @@
 
     @Override
     public void binderDied() {
-        if (DEBUG_EPHEMERAL) {
+        if (DEBUG_INSTANT) {
             Slog.d(TAG, "Binder to instant app resolver died");
         }
         synchronized (mLock) {
@@ -286,7 +281,7 @@
     private final class MyServiceConnection implements ServiceConnection {
         @Override
         public void onServiceConnected(ComponentName name, IBinder service) {
-            if (DEBUG_EPHEMERAL) {
+            if (DEBUG_INSTANT) {
                 Slog.d(TAG, "Connected to instant app resolver");
             }
             synchronized (mLock) {
@@ -295,7 +290,7 @@
                     mBindState = STATE_IDLE;
                 }
                 try {
-                    service.linkToDeath(EphemeralResolverConnection.this, 0 /*flags*/);
+                    service.linkToDeath(InstantAppResolverConnection.this, 0 /*flags*/);
                 } catch (RemoteException e) {
                     handleBinderDiedLocked();
                 }
@@ -305,7 +300,7 @@
 
         @Override
         public void onServiceDisconnected(ComponentName name) {
-            if (DEBUG_EPHEMERAL) {
+            if (DEBUG_INSTANT) {
                 Slog.d(TAG, "Disconnected from instant app resolver");
             }
             synchronized (mLock) {
@@ -314,11 +309,11 @@
         }
     }
 
-    private static final class GetEphemeralResolveInfoCaller
+    private static final class GetInstantAppResolveInfoCaller
             extends TimedRemoteCaller<List<InstantAppResolveInfo>> {
         private final IRemoteCallback mCallback;
 
-        public GetEphemeralResolveInfoCaller() {
+        public GetInstantAppResolveInfoCaller() {
             super(CALL_SERVICE_TIMEOUT_MS);
             mCallback = new IRemoteCallback.Stub() {
                     @Override
@@ -333,7 +328,7 @@
             };
         }
 
-        public List<InstantAppResolveInfo> getEphemeralResolveInfoList(
+        public List<InstantAppResolveInfo> getInstantAppResolveInfoList(
                 IInstantAppResolver target, Intent sanitizedIntent,  int hashPrefix[], String token)
                         throws RemoteException, TimeoutException {
             final int sequence = onBeforeRemoteCall();
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 87d9f17..89fbd17 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -423,7 +423,7 @@
     public static final boolean DEBUG_DEXOPT = false;
 
     private static final boolean DEBUG_ABI_SELECTION = false;
-    private static final boolean DEBUG_EPHEMERAL = Build.IS_DEBUGGABLE;
+    private static final boolean DEBUG_INSTANT = Build.IS_DEBUGGABLE;
     private static final boolean DEBUG_TRIAGED_MISSING = false;
     private static final boolean DEBUG_APP_DATA = false;
 
@@ -981,7 +981,7 @@
     private int mIntentFilterVerificationToken = 0;
 
     /** The service connection to the ephemeral resolver */
-    final EphemeralResolverConnection mInstantAppResolverConnection;
+    final InstantAppResolverConnection mInstantAppResolverConnection;
     /** Component used to show resolver settings for Instant Apps */
     final ComponentName mInstantAppResolverSettingsComponent;
 
@@ -3149,10 +3149,10 @@
             final Pair<ComponentName, String> instantAppResolverComponent =
                     getInstantAppResolverLPr();
             if (instantAppResolverComponent != null) {
-                if (DEBUG_EPHEMERAL) {
+                if (DEBUG_INSTANT) {
                     Slog.d(TAG, "Set ephemeral resolver: " + instantAppResolverComponent);
                 }
-                mInstantAppResolverConnection = new EphemeralResolverConnection(
+                mInstantAppResolverConnection = new InstantAppResolverConnection(
                         mContext, instantAppResolverComponent.first,
                         instantAppResolverComponent.second);
                 mInstantAppResolverSettingsComponent =
@@ -3532,7 +3532,7 @@
         final String[] packageArray =
                 mContext.getResources().getStringArray(R.array.config_ephemeralResolverPackage);
         if (packageArray.length == 0 && !Build.IS_DEBUGGABLE) {
-            if (DEBUG_EPHEMERAL) {
+            if (DEBUG_INSTANT) {
                 Slog.d(TAG, "Ephemeral resolver NOT found; empty package list");
             }
             return null;
@@ -3547,19 +3547,9 @@
         final Intent resolverIntent = new Intent(actionName);
         List<ResolveInfo> resolvers = queryIntentServicesInternal(resolverIntent, null,
                 resolveFlags, UserHandle.USER_SYSTEM, callingUid, false /*includeInstantApps*/);
-        // temporarily look for the old action
-        if (resolvers.size() == 0) {
-            if (DEBUG_EPHEMERAL) {
-                Slog.d(TAG, "Ephemeral resolver not found with new action; try old one");
-            }
-            actionName = Intent.ACTION_RESOLVE_EPHEMERAL_PACKAGE;
-            resolverIntent.setAction(actionName);
-            resolvers = queryIntentServicesInternal(resolverIntent, null,
-                    resolveFlags, UserHandle.USER_SYSTEM, callingUid, false /*includeInstantApps*/);
-        }
         final int N = resolvers.size();
         if (N == 0) {
-            if (DEBUG_EPHEMERAL) {
+            if (DEBUG_INSTANT) {
                 Slog.d(TAG, "Ephemeral resolver NOT found; no matching intent filters");
             }
             return null;
@@ -3575,20 +3565,20 @@
 
             final String packageName = info.serviceInfo.packageName;
             if (!possiblePackages.contains(packageName) && !Build.IS_DEBUGGABLE) {
-                if (DEBUG_EPHEMERAL) {
+                if (DEBUG_INSTANT) {
                     Slog.d(TAG, "Ephemeral resolver not in allowed package list;"
                             + " pkg: " + packageName + ", info:" + info);
                 }
                 continue;
             }
 
-            if (DEBUG_EPHEMERAL) {
+            if (DEBUG_INSTANT) {
                 Slog.v(TAG, "Ephemeral resolver found;"
                         + " pkg: " + packageName + ", info:" + info);
             }
             return new Pair<>(new ComponentName(packageName, info.serviceInfo.name), actionName);
         }
-        if (DEBUG_EPHEMERAL) {
+        if (DEBUG_INSTANT) {
             Slog.v(TAG, "Ephemeral resolver NOT found");
         }
         return null;
@@ -3598,11 +3588,9 @@
         String[] orderedActions = Build.IS_ENG
                 ? new String[]{
                         Intent.ACTION_INSTALL_INSTANT_APP_PACKAGE + "_TEST",
-                        Intent.ACTION_INSTALL_INSTANT_APP_PACKAGE,
-                        Intent.ACTION_INSTALL_EPHEMERAL_PACKAGE}
+                        Intent.ACTION_INSTALL_INSTANT_APP_PACKAGE}
                 : new String[]{
-                        Intent.ACTION_INSTALL_INSTANT_APP_PACKAGE,
-                        Intent.ACTION_INSTALL_EPHEMERAL_PACKAGE};
+                        Intent.ACTION_INSTALL_INSTANT_APP_PACKAGE};
 
         final int resolveFlags =
                 MATCH_DIRECT_BOOT_AWARE
@@ -3618,7 +3606,7 @@
             matches = queryIntentActivitiesInternal(intent, PACKAGE_MIME_TYPE,
                     resolveFlags, UserHandle.USER_SYSTEM);
             if (matches.isEmpty()) {
-                if (DEBUG_EPHEMERAL) {
+                if (DEBUG_INSTANT) {
                     Slog.d(TAG, "Instant App installer not found with " + action);
                 }
             } else {
@@ -3656,15 +3644,6 @@
         final int resolveFlags = MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE;
         List<ResolveInfo> matches = queryIntentActivitiesInternal(intent, null, resolveFlags,
                 UserHandle.USER_SYSTEM);
-        // temporarily look for the old action
-        if (matches.isEmpty()) {
-            if (DEBUG_EPHEMERAL) {
-                Slog.d(TAG, "Ephemeral resolver settings not found with new action; try old one");
-            }
-            intent.setAction(Intent.ACTION_EPHEMERAL_RESOLVER_SETTINGS);
-            matches = queryIntentActivitiesInternal(intent, null, resolveFlags,
-                    UserHandle.USER_SYSTEM);
-        }
         if (matches.isEmpty()) {
             return null;
         }
@@ -6007,7 +5986,7 @@
                         final int status = (int) (packedStatus >> 32);
                         if (status == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS
                             || status == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK) {
-                            if (DEBUG_EPHEMERAL) {
+                            if (DEBUG_INSTANT) {
                                 Slog.v(TAG, "DENY instant app;"
                                     + " pkg: " + packageName + ", status: " + status);
                             }
@@ -6015,7 +5994,7 @@
                         }
                     }
                     if (ps.getInstantApp(userId)) {
-                        if (DEBUG_EPHEMERAL) {
+                        if (DEBUG_INSTANT) {
                             Slog.v(TAG, "DENY instant app installed;"
                                     + " pkg: " + packageName);
                         }
@@ -6651,7 +6630,7 @@
                         // there's a local instant application installed, but, the user has
                         // chosen to never use it; skip resolution and don't acknowledge
                         // an instant application is even available
-                        if (DEBUG_EPHEMERAL) {
+                        if (DEBUG_INSTANT) {
                             Slog.v(TAG, "Instant app marked to never run; pkg: " + packageName);
                         }
                         blockResolution = true;
@@ -6659,7 +6638,7 @@
                     } else {
                         // we have a locally installed instant application; skip resolution
                         // but acknowledge there's an instant application available
-                        if (DEBUG_EPHEMERAL) {
+                        if (DEBUG_INSTANT) {
                             Slog.v(TAG, "Found installed instant app; pkg: " + packageName);
                         }
                         localInstantApp = info;
@@ -6717,7 +6696,7 @@
         // make sure this resolver is the default
         ephemeralInstaller.isDefault = true;
         ephemeralInstaller.auxiliaryInfo = auxiliaryResponse;
-        if (DEBUG_EPHEMERAL) {
+        if (DEBUG_INSTANT) {
             Slog.v(TAG, "Adding ephemeral installer to the ResolveInfo list");
         }
 
@@ -7604,7 +7583,7 @@
                                 info.serviceInfo.splitName)) {
                     // requested service is defined in a split that hasn't been installed yet.
                     // add the installer to the resolve list
-                    if (DEBUG_EPHEMERAL) {
+                    if (DEBUG_INSTANT) {
                         Slog.v(TAG, "Adding ephemeral installer to the ResolveInfo list");
                     }
                     final ResolveInfo installerInfo = new ResolveInfo(
@@ -7726,7 +7705,7 @@
                                 info.providerInfo.splitName)) {
                     // requested provider is defined in a split that hasn't been installed yet.
                     // add the installer to the resolve list
-                    if (DEBUG_EPHEMERAL) {
+                    if (DEBUG_INSTANT) {
                         Slog.v(TAG, "Adding ephemeral installer to the ResolveInfo list");
                     }
                     final ResolveInfo installerInfo = new ResolveInfo(
@@ -11803,14 +11782,14 @@
 
     private void setUpInstantAppInstallerActivityLP(ActivityInfo installerActivity) {
         if (installerActivity == null) {
-            if (DEBUG_EPHEMERAL) {
+            if (DEBUG_INSTANT) {
                 Slog.d(TAG, "Clear ephemeral installer activity");
             }
             mInstantAppInstallerActivity = null;
             return;
         }
 
-        if (DEBUG_EPHEMERAL) {
+        if (DEBUG_INSTANT) {
             Slog.d(TAG, "Set ephemeral installer activity: "
                     + installerActivity.getComponentName());
         }
@@ -13270,7 +13249,7 @@
         private int mFlags;
     }
 
-    static final class EphemeralIntentResolver
+    static final class InstantAppIntentResolver
             extends IntentResolver<AuxiliaryResolveInfo.AuxiliaryFilter,
             AuxiliaryResolveInfo.AuxiliaryFilter> {
         /**
@@ -13640,7 +13619,7 @@
             IPackageInstallObserver2 observer, PackageInstaller.SessionParams sessionParams,
             String installerPackageName, int installerUid, UserHandle user,
             PackageParser.SigningDetails signingDetails) {
-        if (DEBUG_EPHEMERAL) {
+        if (DEBUG_INSTANT) {
             if ((sessionParams.installFlags & PackageManager.INSTALL_INSTANT_APP) != 0) {
                 Slog.d(TAG, "Ephemeral install of " + packageName);
             }
@@ -15124,7 +15103,7 @@
                 pkgLite = mContainerService.getMinimalPackageInfo(origin.resolvedPath, installFlags,
                         packageAbiOverride);
 
-                if (DEBUG_EPHEMERAL && ephemeral) {
+                if (DEBUG_INSTANT && ephemeral) {
                     Slog.v(TAG, "pkgLite for install: " + pkgLite);
                 }
 
@@ -15191,7 +15170,7 @@
                             installFlags |= PackageManager.INSTALL_EXTERNAL;
                             installFlags &= ~PackageManager.INSTALL_INTERNAL;
                         } else if (loc == PackageHelper.RECOMMEND_INSTALL_EPHEMERAL) {
-                            if (DEBUG_EPHEMERAL) {
+                            if (DEBUG_INSTANT) {
                                 Slog.v(TAG, "...setting INSTALL_EPHEMERAL install flag");
                             }
                             installFlags |= PackageManager.INSTALL_INSTANT_APP;
diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java
index ae5341b..a0d1480 100644
--- a/services/core/java/com/android/server/wm/TaskStack.java
+++ b/services/core/java/com/android/server/wm/TaskStack.java
@@ -21,6 +21,7 @@
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
+import static android.app.WindowConfiguration.PINNED_WINDOWING_MODE_ELEVATION_IN_DIP;
 import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
 import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET;
 import static android.content.res.Configuration.DENSITY_DPI_UNDEFINED;
@@ -53,6 +54,7 @@
 import android.graphics.Rect;
 import android.graphics.Region;
 import android.os.RemoteException;
+import android.util.DisplayMetrics;
 import android.util.EventLog;
 import android.util.Slog;
 import android.util.SparseArray;
@@ -741,14 +743,32 @@
         scheduleAnimation();
     }
 
+    /**
+     * Calculate an amount by which to expand the stack bounds in each direction.
+     * Used to make room for shadows in the pinned windowing mode.
+     */
+    int getStackOutset() {
+        if (inPinnedWindowingMode()) {
+            final DisplayMetrics displayMetrics = getDisplayContent().getDisplayMetrics();
+            return mService.dipToPixel(PINNED_WINDOWING_MODE_ELEVATION_IN_DIP,
+                    displayMetrics);
+        }
+        return 0;
+    }
+
     private void updateSurfaceSize(SurfaceControl.Transaction transaction) {
         if (mSurfaceControl == null) {
             return;
         }
 
         final Rect stackBounds = getBounds();
-        final int width = stackBounds.width();
-        final int height = stackBounds.height();
+        int width = stackBounds.width();
+        int height = stackBounds.height();
+
+        final int outset = getStackOutset();
+        width += 2*outset;
+        height += 2*outset;
+
         if (width == mLastSurfaceSize.x && height == mLastSurfaceSize.y) {
             return;
         }
@@ -1749,4 +1769,12 @@
         mDimmer.stopDim(getPendingTransaction());
         scheduleAnimation();
     }
+
+    @Override
+    void getRelativePosition(Point outPos) {
+        super.getRelativePosition(outPos);
+        final int outset = getStackOutset();
+        outPos.x -= outset;
+        outPos.y -= outset;
+    }
 }
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 53a8d82..36e3612 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -4576,6 +4576,17 @@
             outPoint.offset(-parentBounds.left, -parentBounds.top);
         }
 
+        TaskStack stack = getStack();
+
+        // If we have stack outsets, that means the top-left
+        // will be outset, and we need to inset ourselves
+        // to account for it. If we actually have shadows we will
+        // then un-inset ourselves by the surfaceInsets.
+        if (stack != null) {
+            final int outset = stack.getStackOutset();
+            outPoint.offset(outset, outset);
+        }
+
         // Expand for surface insets. See WindowState.expandForSurfaceInsets.
         outPoint.offset(-mAttrs.surfaceInsets.left, -mAttrs.surfaceInsets.top);
     }
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index 1cfa956..5c9cfbb 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -99,7 +99,6 @@
     // Unchanging local convenience fields.
     final WindowManagerService mService;
     final WindowState mWin;
-    private final WindowStateAnimator mParentWinAnimator;
     final WindowAnimator mAnimator;
     final Session mSession;
     final WindowManagerPolicy mPolicy;
@@ -135,8 +134,6 @@
     float mAlpha = 0;
     float mLastAlpha = 0;
 
-    boolean mHasClipRect;
-    Rect mClipRect = new Rect();
     Rect mTmpClipRect = new Rect();
     Rect mTmpFinalClipRect = new Rect();
     Rect mLastClipRect = new Rect();
@@ -150,7 +147,6 @@
      * system decorations.
      */
     private final Rect mSystemDecorRect = new Rect();
-    private final Rect mLastSystemDecorRect = new Rect();
 
     float mDsDx=1, mDtDx=0, mDsDy=0, mDtDy=1;
     private float mLastDsDx=1, mLastDtDx=0, mLastDsDy=0, mLastDtDy=1;
@@ -224,7 +220,6 @@
         mContext = service.mContext;
 
         mWin = win;
-        mParentWinAnimator = !win.isChildWindow() ? null : win.getParentWindow().mWinAnimator;
         mSession = win.mSession;
         mAttrType = win.mAttrs.type;
         mIsWallpaper = win.mIsWallpaper;
@@ -455,9 +450,6 @@
         }
 
         // We may abort, so initialize to defaults.
-        mLastSystemDecorRect.set(0, 0, 0, 0);
-        mHasClipRect = false;
-        mClipRect.set(0, 0, 0, 0);
         mLastClipRect.set(0, 0, 0, 0);
 
         // Set up surface control with initial size.
@@ -649,14 +641,12 @@
     }
 
     void computeShownFrameLocked() {
-
         final int displayId = mWin.getDisplayId();
         final ScreenRotationAnimation screenRotationAnimation =
                 mAnimator.getScreenRotationAnimationLocked(displayId);
         final boolean screenAnimation =
                 screenRotationAnimation != null && screenRotationAnimation.isAnimating();
 
-        mHasClipRect = false;
         if (screenAnimation) {
             // cache often used attributes locally
             final Rect frame = mWin.mFrame;
@@ -796,9 +786,9 @@
 
         // We use the clip rect as provided by the tranformation for non-fullscreen windows to
         // avoid premature clipping with the system decor rect.
-        clipRect.set((mHasClipRect && !fullscreen) ? mClipRect : mSystemDecorRect);
+        clipRect.set(mSystemDecorRect);
         if (DEBUG_WINDOW_CROP) Slog.d(TAG, "win=" + w + " Initial clip rect: " + clipRect
-                + " mHasClipRect=" + mHasClipRect + " fullscreen=" + fullscreen);
+                + " fullscreen=" + fullscreen);
 
         if (isFreeformResizing && !w.isChildWindow()) {
             // For freeform resizing non child windows, we are using the big surface positioned
@@ -808,12 +798,6 @@
 
         w.expandForSurfaceInsets(clipRect);
 
-        if (mHasClipRect && fullscreen) {
-            // We intersect the clip rect specified by the transformation with the expanded system
-            // decor rect to prevent artifacts from drawing during animation if the transformation
-            // clip rect extends outside the system decor rect.
-            clipRect.intersect(mClipRect);
-        }
         // The clip rect was generated assuming (0,0) as the window origin,
         // so we need to translate to match the actual surface coordinates.
         clipRect.offset(w.mAttrs.surfaceInsets.left, w.mAttrs.surfaceInsets.top);
@@ -1378,8 +1362,6 @@
             pw.print(prefix); pw.print("mDrawState="); pw.print(drawStateToString());
             pw.print(prefix); pw.print(" mLastHidden="); pw.println(mLastHidden);
             pw.print(prefix); pw.print("mSystemDecorRect="); mSystemDecorRect.printShortString(pw);
-            pw.print(" last="); mLastSystemDecorRect.printShortString(pw);
-            pw.print(" mHasClipRect="); pw.print(mHasClipRect);
             pw.print(" mLastClipRect="); mLastClipRect.printShortString(pw);
 
             if (!mLastFinalClipRect.isEmpty()) {