Merge "Import translations. DO NOT MERGE ANYWHERE" into sc-dev
diff --git a/core/api/current.txt b/core/api/current.txt
index 5bca9c5..b1e8645 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -10387,6 +10387,7 @@
     method public abstract android.content.pm.PackageManager getPackageManager();
     method public abstract String getPackageName();
     method public abstract String getPackageResourcePath();
+    method @Nullable public android.content.ContextParams getParams();
     method public abstract android.content.res.Resources getResources();
     method public abstract android.content.SharedPreferences getSharedPreferences(String, int);
     method @NonNull public final String getString(@StringRes int);
@@ -21962,16 +21963,17 @@
     field public static final int ERROR_PROVISIONING_CERTIFICATE = 24; // 0x18
     field public static final int ERROR_PROVISIONING_CONFIG = 25; // 0x19
     field public static final int ERROR_PROVISIONING_PARSE = 26; // 0x1a
-    field public static final int ERROR_PROVISIONING_RETRY = 27; // 0x1b
+    field public static final int ERROR_PROVISIONING_REQUEST_REJECTED = 27; // 0x1b
+    field public static final int ERROR_PROVISIONING_RETRY = 28; // 0x1c
     field public static final int ERROR_RESOURCE_BUSY = 3; // 0x3
-    field public static final int ERROR_RESOURCE_CONTENTION = 28; // 0x1c
-    field public static final int ERROR_SECURE_STOP_RELEASE = 29; // 0x1d
+    field public static final int ERROR_RESOURCE_CONTENTION = 29; // 0x1d
+    field public static final int ERROR_SECURE_STOP_RELEASE = 30; // 0x1e
     field public static final int ERROR_SESSION_NOT_OPENED = 5; // 0x5
-    field public static final int ERROR_STORAGE_READ = 30; // 0x1e
-    field public static final int ERROR_STORAGE_WRITE = 31; // 0x1f
+    field public static final int ERROR_STORAGE_READ = 31; // 0x1f
+    field public static final int ERROR_STORAGE_WRITE = 32; // 0x20
     field public static final int ERROR_UNKNOWN = 0; // 0x0
     field public static final int ERROR_UNSUPPORTED_OPERATION = 6; // 0x6
-    field public static final int ERROR_ZERO_SUBSAMPLES = 32; // 0x20
+    field public static final int ERROR_ZERO_SUBSAMPLES = 33; // 0x21
   }
 
   @Deprecated @IntDef({android.media.MediaDrm.HDCP_LEVEL_UNKNOWN, android.media.MediaDrm.HDCP_NONE, android.media.MediaDrm.HDCP_V1, android.media.MediaDrm.HDCP_V2, android.media.MediaDrm.HDCP_V2_1, android.media.MediaDrm.HDCP_V2_2, android.media.MediaDrm.HDCP_V2_3, android.media.MediaDrm.HDCP_NO_DIGITAL_OUTPUT}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface MediaDrm.HdcpLevel {
diff --git a/core/api/module-lib-current.txt b/core/api/module-lib-current.txt
index ad2942a..f7e6e03 100644
--- a/core/api/module-lib-current.txt
+++ b/core/api/module-lib-current.txt
@@ -144,7 +144,6 @@
 
   public final class MediaSessionManager {
     method public void addOnActiveSessionsChangedListener(@Nullable android.content.ComponentName, @NonNull android.os.UserHandle, @NonNull java.util.concurrent.Executor, @NonNull android.media.session.MediaSessionManager.OnActiveSessionsChangedListener);
-    method public void dispatchMediaKeyEvent(@NonNull android.view.KeyEvent);
     method public void dispatchMediaKeyEvent(@NonNull android.view.KeyEvent, boolean);
     method public void dispatchMediaKeyEventAsSystemService(@NonNull android.view.KeyEvent);
     method public boolean dispatchMediaKeyEventToSessionAsSystemService(@NonNull android.view.KeyEvent, @NonNull android.media.session.MediaSession.Token);
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index 53e1539..5d8eade 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -228,6 +228,7 @@
     field public static final String REMOTE_DISPLAY_PROVIDER = "android.permission.REMOTE_DISPLAY_PROVIDER";
     field public static final String REMOVE_DRM_CERTIFICATES = "android.permission.REMOVE_DRM_CERTIFICATES";
     field public static final String REMOVE_TASKS = "android.permission.REMOVE_TASKS";
+    field public static final String RENOUNCE_PERMISSIONS = "android.permission.RENOUNCE_PERMISSIONS";
     field public static final String REQUEST_NETWORK_SCORES = "android.permission.REQUEST_NETWORK_SCORES";
     field public static final String REQUEST_NOTIFICATION_ASSISTANT_SERVICE = "android.permission.REQUEST_NOTIFICATION_ASSISTANT_SERVICE";
     field public static final String RESET_PASSWORD = "android.permission.RESET_PASSWORD";
@@ -2184,6 +2185,14 @@
     field public static final String WIFI_SCANNING_SERVICE = "wifiscanner";
   }
 
+  public final class ContextParams {
+    method @Nullable @RequiresPermission(android.Manifest.permission.RENOUNCE_PERMISSIONS) public java.util.Set<java.lang.String> getRenouncedPermissions();
+  }
+
+  public static final class ContextParams.Builder {
+    method @NonNull @RequiresPermission(android.Manifest.permission.RENOUNCE_PERMISSIONS) public android.content.ContextParams.Builder setRenouncedPermissions(@NonNull java.util.Set<java.lang.String>);
+  }
+
   public class ContextWrapper extends android.content.Context {
     method public android.content.Context createCredentialProtectedStorageContext();
     method @Nullable public java.io.File getPreloadsFileCache();
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index fd56c44..d040938 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -24,7 +24,6 @@
 import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.compat.annotation.UnsupportedAppUsage;
-import android.content.ContextParams;
 import android.content.AutofillOptions;
 import android.content.BroadcastReceiver;
 import android.content.ComponentName;
@@ -32,6 +31,7 @@
 import android.content.ContentProvider;
 import android.content.ContentResolver;
 import android.content.Context;
+import android.content.ContextParams;
 import android.content.ContextWrapper;
 import android.content.IContentProvider;
 import android.content.IIntentReceiver;
@@ -221,8 +221,7 @@
     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
     private final String mOpPackageName;
 
-    /** Attribution tag of this context */
-    private final @Nullable String mAttributionTag;
+    private final @NonNull ContextParams mParams;
 
     private final @NonNull ResourcesManager mResourcesManager;
     @UnsupportedAppUsage
@@ -470,7 +469,12 @@
     /** @hide */
     @Override
     public @Nullable String getAttributionTag() {
-        return mAttributionTag;
+        return mParams.getAttributionTag();
+    }
+
+    @Override
+    public @Nullable ContextParams getParams() {
+        return mParams;
     }
 
     @Override
@@ -2047,6 +2051,11 @@
         if (permission == null) {
             throw new IllegalArgumentException("permission is null");
         }
+        if (mParams.isRenouncedPermission(permission)
+                && pid == android.os.Process.myPid() && uid == android.os.Process.myUid()) {
+            Log.v(TAG, "Treating renounced permission " + permission + " as denied");
+            return PERMISSION_DENIED;
+        }
         return PermissionManager.checkPermission(permission, pid, uid);
     }
 
@@ -2056,6 +2065,11 @@
         if (permission == null) {
             throw new IllegalArgumentException("permission is null");
         }
+        if (mParams.isRenouncedPermission(permission)
+                && pid == android.os.Process.myPid() && uid == android.os.Process.myUid()) {
+            Log.v(TAG, "Treating renounced permission " + permission + " as denied");
+            return PERMISSION_DENIED;
+        }
 
         try {
             return ActivityManager.getService().checkPermissionWithToken(
@@ -2093,6 +2107,10 @@
         if (permission == null) {
             throw new IllegalArgumentException("permission is null");
         }
+        if (mParams.isRenouncedPermission(permission)) {
+            Log.v(TAG, "Treating renounced permission " + permission + " as denied");
+            return PERMISSION_DENIED;
+        }
 
         return checkPermission(permission, Process.myPid(), Process.myUid());
     }
@@ -2393,8 +2411,9 @@
         LoadedApk pi = mMainThread.getPackageInfo(application, mResources.getCompatibilityInfo(),
                 flags | CONTEXT_REGISTER_PACKAGE);
         if (pi != null) {
-            ContextImpl c = new ContextImpl(this, mMainThread, pi, null, null, mToken,
-                    new UserHandle(UserHandle.getUserId(application.uid)), flags, null, null);
+            ContextImpl c = new ContextImpl(this, mMainThread, pi, ContextParams.EMPTY, null,
+                    mToken, new UserHandle(UserHandle.getUserId(application.uid)),
+                    flags, null, null);
 
             final int displayId = getDisplayId();
             final Integer overrideDisplayId = mForceDisplayOverrideInResources
@@ -2423,14 +2442,14 @@
         if (packageName.equals("system") || packageName.equals("android")) {
             // The system resources are loaded in every application, so we can safely copy
             // the context without reloading Resources.
-            return new ContextImpl(this, mMainThread, mPackageInfo, mAttributionTag, null,
+            return new ContextImpl(this, mMainThread, mPackageInfo, mParams, null,
                     mToken, user, flags, null, null);
         }
 
         LoadedApk pi = mMainThread.getPackageInfo(packageName, mResources.getCompatibilityInfo(),
                 flags | CONTEXT_REGISTER_PACKAGE, user.getIdentifier());
         if (pi != null) {
-            ContextImpl c = new ContextImpl(this, mMainThread, pi, mAttributionTag, null,
+            ContextImpl c = new ContextImpl(this, mMainThread, pi, mParams, null,
                     mToken, user, flags, null, null);
 
             final int displayId = getDisplayId();
@@ -2469,7 +2488,7 @@
         final String[] paths = mPackageInfo.getSplitPaths(splitName);
 
         final ContextImpl context = new ContextImpl(this, mMainThread, mPackageInfo,
-                mAttributionTag, splitName, mToken, mUser, mFlags, classLoader, null);
+                mParams, splitName, mToken, mUser, mFlags, classLoader, null);
 
         context.setResources(ResourcesManager.getInstance().getResources(
                 mToken,
@@ -2502,7 +2521,7 @@
             overrideConfiguration = displayAdjustedConfig;
         }
 
-        ContextImpl context = new ContextImpl(this, mMainThread, mPackageInfo, mAttributionTag,
+        ContextImpl context = new ContextImpl(this, mMainThread, mPackageInfo, mParams,
                 mSplitName, mToken, mUser, mFlags, mClassLoader, null);
 
         final int displayId = getDisplayId();
@@ -2520,7 +2539,7 @@
             throw new IllegalArgumentException("display must not be null");
         }
 
-        ContextImpl context = new ContextImpl(this, mMainThread, mPackageInfo, mAttributionTag,
+        ContextImpl context = new ContextImpl(this, mMainThread, mPackageInfo, mParams,
                 mSplitName, mToken, mUser, mFlags, mClassLoader, null);
 
         final int displayId = display.getDisplayId();
@@ -2578,7 +2597,7 @@
 
 
     ContextImpl createBaseWindowContext(IBinder token, Display display) {
-        ContextImpl context = new ContextImpl(this, mMainThread, mPackageInfo, mAttributionTag,
+        ContextImpl context = new ContextImpl(this, mMainThread, mPackageInfo, mParams,
                 mSplitName, token, mUser, mFlags, mClassLoader, null);
         // Window contexts receive configurations directly from the server and as such do not
         // need to override their display in ResourcesManager.
@@ -2609,21 +2628,21 @@
 
     @NonNull
     @Override
-    public Context createContext(@NonNull ContextParams contextParams) {
-        return this;
+    public Context createContext(@NonNull ContextParams params) {
+        return new ContextImpl(this, mMainThread, mPackageInfo, params, mSplitName,
+                mToken, mUser, mFlags, mClassLoader, null);
     }
 
     @Override
     public @NonNull Context createAttributionContext(@Nullable String attributionTag) {
-        return new ContextImpl(this, mMainThread, mPackageInfo, attributionTag, mSplitName,
-                mToken, mUser, mFlags, mClassLoader, null);
+        return createContext(new ContextParams.Builder().setAttributionTag(attributionTag).build());
     }
 
     @Override
     public Context createDeviceProtectedStorageContext() {
         final int flags = (mFlags & ~Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE)
                 | Context.CONTEXT_DEVICE_PROTECTED_STORAGE;
-        return new ContextImpl(this, mMainThread, mPackageInfo, mAttributionTag, mSplitName,
+        return new ContextImpl(this, mMainThread, mPackageInfo, mParams, mSplitName,
                 mToken, mUser, flags, mClassLoader, null);
     }
 
@@ -2631,7 +2650,7 @@
     public Context createCredentialProtectedStorageContext() {
         final int flags = (mFlags & ~Context.CONTEXT_DEVICE_PROTECTED_STORAGE)
                 | Context.CONTEXT_CREDENTIAL_PROTECTED_STORAGE;
-        return new ContextImpl(this, mMainThread, mPackageInfo, mAttributionTag, mSplitName,
+        return new ContextImpl(this, mMainThread, mPackageInfo, mParams, mSplitName,
                 mToken, mUser, flags, mClassLoader, null);
     }
 
@@ -2805,8 +2824,8 @@
     @UnsupportedAppUsage
     static ContextImpl createSystemContext(ActivityThread mainThread) {
         LoadedApk packageInfo = new LoadedApk(mainThread);
-        ContextImpl context = new ContextImpl(null, mainThread, packageInfo, null, null, null, null,
-                0, null, null);
+        ContextImpl context = new ContextImpl(null, mainThread, packageInfo,
+                ContextParams.EMPTY, null, null, null, 0, null, null);
         context.setResources(packageInfo.getResources());
         context.mResources.updateConfiguration(context.mResourcesManager.getConfiguration(),
                 context.mResourcesManager.getDisplayMetrics());
@@ -2823,8 +2842,8 @@
      */
     static ContextImpl createSystemUiContext(ContextImpl systemContext, int displayId) {
         final LoadedApk packageInfo = systemContext.mPackageInfo;
-        ContextImpl context = new ContextImpl(null, systemContext.mMainThread, packageInfo, null,
-                null, null, null, 0, null, null);
+        ContextImpl context = new ContextImpl(null, systemContext.mMainThread, packageInfo,
+                ContextParams.EMPTY, null, null, null, 0, null, null);
         context.setResources(createResources(null, packageInfo, null, displayId, null,
                 packageInfo.getCompatibilityInfo(), null));
         context.updateDisplay(displayId);
@@ -2848,8 +2867,8 @@
     static ContextImpl createAppContext(ActivityThread mainThread, LoadedApk packageInfo,
             String opPackageName) {
         if (packageInfo == null) throw new IllegalArgumentException("packageInfo");
-        ContextImpl context = new ContextImpl(null, mainThread, packageInfo, null, null, null, null,
-                0, null, opPackageName);
+        ContextImpl context = new ContextImpl(null, mainThread, packageInfo,
+                ContextParams.EMPTY, null, null, null, 0, null, opPackageName);
         context.setResources(packageInfo.getResources());
         context.mContextType = isSystemOrSystemUI(context) ? CONTEXT_TYPE_SYSTEM_OR_SYSTEM_UI
                 : CONTEXT_TYPE_NON_UI;
@@ -2878,7 +2897,7 @@
             }
         }
 
-        ContextImpl context = new ContextImpl(null, mainThread, packageInfo, null,
+        ContextImpl context = new ContextImpl(null, mainThread, packageInfo, ContextParams.EMPTY,
                 activityInfo.splitName, activityToken, null, 0, classLoader, null);
         context.mContextType = CONTEXT_TYPE_ACTIVITY;
 
@@ -2911,7 +2930,7 @@
     }
 
     private ContextImpl(@Nullable ContextImpl container, @NonNull ActivityThread mainThread,
-            @NonNull LoadedApk packageInfo, @Nullable String attributionTag,
+            @NonNull LoadedApk packageInfo, @NonNull ContextParams params,
             @Nullable String splitName, @Nullable IBinder token, @Nullable UserHandle user,
             int flags, @Nullable ClassLoader classLoader, @Nullable String overrideOpPackageName) {
         mOuterContext = this;
@@ -2966,7 +2985,7 @@
         }
 
         mOpPackageName = overrideOpPackageName != null ? overrideOpPackageName : opPackageName;
-        mAttributionTag = attributionTag;
+        mParams = Objects.requireNonNull(params);
         mContentResolver = new ApplicationContentResolver(this, mainThread);
     }
 
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 30b3d43..df5c58c 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -888,6 +888,14 @@
         return getAttributionTag();
     }
 
+    /**
+     * Return the set of parameters which this Context was created with, if it
+     * was created via {@link #createContext(ContextParams)}.
+     */
+    public @Nullable ContextParams getParams() {
+        return null;
+    }
+
     /** Return the full application info for this context's package. */
     public abstract ApplicationInfo getApplicationInfo();
 
diff --git a/core/java/android/content/ContextParams.java b/core/java/android/content/ContextParams.java
index 16128a6..17ec2a8 100644
--- a/core/java/android/content/ContextParams.java
+++ b/core/java/android/content/ContextParams.java
@@ -18,6 +18,13 @@
 
 import android.annotation.NonNull;
 import android.annotation.Nullable;
+import android.annotation.RequiresPermission;
+import android.annotation.SuppressLint;
+import android.annotation.SystemApi;
+
+import java.util.Collections;
+import java.util.Objects;
+import java.util.Set;
 
 /**
  * This class represents rules around how a context being created via
@@ -48,9 +55,19 @@
  * @see Context#createContext(ContextParams)
  */
 public final class ContextParams {
+    private final String mAttributionTag;
+    private final String mReceiverPackage;
+    private final String mReceiverAttributionTag;
+    private final Set<String> mRenouncedPermissions;
 
-    private ContextParams() {
-        /* hide ctor */
+    /** {@hide} */
+    public static final ContextParams EMPTY = new ContextParams.Builder().build();
+
+    private ContextParams(@NonNull ContextParams.Builder builder) {
+        mAttributionTag = builder.mAttributionTag;
+        mReceiverPackage = builder.mReceiverPackage;
+        mReceiverAttributionTag = builder.mReceiverAttributionTag;
+        mRenouncedPermissions = builder.mRenouncedPermissions;
     }
 
     /**
@@ -58,7 +75,7 @@
      */
     @Nullable
     public String getAttributionTag() {
-        return null;
+        return mAttributionTag;
     }
 
     /**
@@ -66,7 +83,7 @@
      */
     @Nullable
     public String getReceiverPackage() {
-        return null;
+        return mReceiverPackage;
     }
 
     /**
@@ -74,13 +91,33 @@
      */
     @Nullable
     public String getReceiverAttributionTag() {
-        return null;
+        return mReceiverAttributionTag;
+    }
+
+    /**
+     * @return The set of permissions to treat as renounced.
+     * @hide
+     */
+    @SystemApi
+    @SuppressLint("NullableCollection")
+    @RequiresPermission(android.Manifest.permission.RENOUNCE_PERMISSIONS)
+    public @Nullable Set<String> getRenouncedPermissions() {
+        return mRenouncedPermissions;
+    }
+
+    /** @hide */
+    public boolean isRenouncedPermission(@NonNull String permission) {
+        return mRenouncedPermissions != null && mRenouncedPermissions.contains(permission);
     }
 
     /**
      * Builder for creating a {@link ContextParams}.
      */
     public static final class Builder {
+        private String mAttributionTag;
+        private String mReceiverPackage;
+        private String mReceiverAttributionTag;
+        private Set<String> mRenouncedPermissions;
 
         /**
          * Sets an attribution tag against which to track permission accesses.
@@ -90,6 +127,7 @@
          */
         @NonNull
         public Builder setAttributionTag(@NonNull String attributionTag) {
+            mAttributionTag = Objects.requireNonNull(attributionTag);
             return this;
         }
 
@@ -104,18 +142,46 @@
         @NonNull
         public Builder setReceiverPackage(@NonNull String packageName,
                 @Nullable String attributionTag) {
+            mReceiverPackage = Objects.requireNonNull(packageName);
+            mReceiverAttributionTag = attributionTag;
             return this;
         }
 
         /**
-         * Creates a new instance. You need to either specify an attribution tag
-         * or a receiver package or both.
+         * Sets permissions which have been voluntarily "renounced" by the
+         * calling app.
+         * <p>
+         * Interactions performed through the created Context will ideally be
+         * treated as if these "renounced" permissions have not actually been
+         * granted to the app, regardless of their actual grant status.
+         * <p>
+         * This is designed for use by separate logical components within an app
+         * which have no intention of interacting with data or services that are
+         * protected by the renounced permissions.
+         * <p>
+         * Note that only {@link PermissionInfo#PROTECTION_DANGEROUS}
+         * permissions are supported by this mechanism.
+         *
+         * @param renouncedPermissions The set of permissions to treat as
+         *            renounced.
+         * @return This builder.
+         * @hide
+         */
+        @SystemApi
+        @RequiresPermission(android.Manifest.permission.RENOUNCE_PERMISSIONS)
+        public @NonNull Builder setRenouncedPermissions(@NonNull Set<String> renouncedPermissions) {
+            mRenouncedPermissions = Collections.unmodifiableSet(renouncedPermissions);
+            return this;
+        }
+
+        /**
+         * Creates a new instance.
          *
          * @return The new instance.
          */
         @NonNull
         public ContextParams build() {
-            return new ContextParams();
+            return new ContextParams(this);
         }
     }
 }
diff --git a/core/java/android/content/ContextWrapper.java b/core/java/android/content/ContextWrapper.java
index b71fb27..609f417 100644
--- a/core/java/android/content/ContextWrapper.java
+++ b/core/java/android/content/ContextWrapper.java
@@ -172,6 +172,11 @@
     }
 
     @Override
+    public @Nullable ContextParams getParams() {
+        return mBase.getParams();
+    }
+
+    @Override
     public ApplicationInfo getApplicationInfo() {
         return mBase.getApplicationInfo();
     }
@@ -1045,6 +1050,12 @@
     }
 
     @Override
+    @NonNull
+    public Context createContext(@NonNull ContextParams contextParams) {
+        return mBase.createContext(contextParams);
+    }
+
+    @Override
     public @NonNull Context createAttributionContext(@Nullable String attributionTag) {
         return mBase.createAttributionContext(attributionTag);
     }
diff --git a/core/java/android/view/SurfaceControlFpsListener.java b/core/java/android/view/SurfaceControlFpsListener.java
index 517b0fb..20a511a 100644
--- a/core/java/android/view/SurfaceControlFpsListener.java
+++ b/core/java/android/view/SurfaceControlFpsListener.java
@@ -57,14 +57,14 @@
     public abstract void onFpsReported(float fps);
 
     /**
-     * Registers the sampling listener.
+     * Registers the sampling listener for a particular task ID
      */
-    public void register(@NonNull SurfaceControl layer) {
+    public void register(int taskId) {
         if (mNativeListener == 0) {
             return;
         }
 
-        nativeRegister(mNativeListener, layer.mNativeObject);
+        nativeRegister(mNativeListener, taskId);
     }
 
     /**
@@ -82,12 +82,13 @@
      *
      * Called from native code on a binder thread.
      */
-    private static void dispatchOnFpsReported(SurfaceControlFpsListener listener, float fps) {
+    private static void dispatchOnFpsReported(
+            @NonNull SurfaceControlFpsListener listener, float fps) {
         listener.onFpsReported(fps);
     }
 
     private static native long nativeCreate(SurfaceControlFpsListener thiz);
     private static native void nativeDestroy(long ptr);
-    private static native void nativeRegister(long ptr, long layerObject);
+    private static native void nativeRegister(long ptr, int taskId);
     private static native void nativeUnregister(long ptr);
 }
diff --git a/core/jni/android_view_SurfaceControlFpsListener.cpp b/core/jni/android_view_SurfaceControlFpsListener.cpp
index 6fa12e5..0b15acd 100644
--- a/core/jni/android_view_SurfaceControlFpsListener.cpp
+++ b/core/jni/android_view_SurfaceControlFpsListener.cpp
@@ -84,11 +84,9 @@
     listener->decStrong((void*)nativeCreate);
 }
 
-void nativeRegister(JNIEnv* env, jclass clazz, jlong ptr, jlong layerObj) {
+void nativeRegister(JNIEnv* env, jclass clazz, jlong ptr, jint taskId) {
     sp<SurfaceControlFpsListener> listener = reinterpret_cast<SurfaceControlFpsListener*>(ptr);
-    auto layer = reinterpret_cast<SurfaceControl*>(layerObj);
-    sp<IBinder> layerHandle = layer != nullptr ? layer->getHandle() : nullptr;
-    if (SurfaceComposerClient::addFpsListener(layerHandle, listener) != OK) {
+    if (SurfaceComposerClient::addFpsListener(taskId, listener) != OK) {
         constexpr auto error_msg = "Couldn't addFpsListener";
         ALOGE(error_msg);
         jniThrowRuntimeException(env, error_msg);
@@ -109,7 +107,7 @@
         /* name, signature, funcPtr */
         {"nativeCreate", "(Landroid/view/SurfaceControlFpsListener;)J", (void*)nativeCreate},
         {"nativeDestroy", "(J)V", (void*)nativeDestroy},
-        {"nativeRegister", "(JJ)V", (void*)nativeRegister},
+        {"nativeRegister", "(JI)V", (void*)nativeRegister},
         {"nativeUnregister", "(J)V", (void*)nativeUnregister}};
 
 } // namespace
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 072bb87..4bbb69f 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -5561,6 +5561,11 @@
     <permission android:name="android.permission.READ_PEOPLE_DATA"
                 android:protectionLevel="signature|appPredictor|recents"/>
 
+    <!-- @hide @SystemApi Allows a logical component within an application to
+         temporarily renounce a set of otherwise granted permissions. -->
+    <permission android:name="android.permission.RENOUNCE_PERMISSIONS"
+                android:protectionLevel="signature|privileged" />
+
     <!-- Attribution for Geofencing service. -->
     <attribution android:tag="GeofencingService" android:label="@string/geofencing_service"/>
     <!-- Attribution for Country Detector. -->
diff --git a/core/res/res/values-si/strings.xml b/core/res/res/values-si/strings.xml
index 76ee189..e01a1c4 100644
--- a/core/res/res/values-si/strings.xml
+++ b/core/res/res/values-si/strings.xml
@@ -550,23 +550,18 @@
     <string name="permdesc_imagesWrite" msgid="5195054463269193317">"ඔබගේ ඡායාරූප එකතුව වෙනස් කිරීමට යෙදුමට ඉඩ දෙයි."</string>
     <string name="permlab_mediaLocation" msgid="7368098373378598066">"ඔබගේ මාධ්‍ය එකතුවෙන් ස්ථාන කියවන්න"</string>
     <string name="permdesc_mediaLocation" msgid="597912899423578138">"ඔබගේ මාධ්‍ය එකතුවෙන් ස්ථාන කියවීමට යෙදුමට ඉඩ දෙයි."</string>
-    <!-- no translation found for biometric_app_setting_name (3339209978734534457) -->
-    <skip />
-    <!-- no translation found for biometric_or_screen_lock_app_setting_name (5348462421758257752) -->
-    <skip />
+    <string name="biometric_app_setting_name" msgid="3339209978734534457">"ජෛවමිතික භාවිත කරන්න"</string>
+    <string name="biometric_or_screen_lock_app_setting_name" msgid="5348462421758257752">"ජෛවමිතික හෝ තිර අගුල භාවිත කරන්න"</string>
     <string name="biometric_dialog_default_title" msgid="55026799173208210">"එය ඔබ බව තහවුරු කරන්න"</string>
-    <!-- no translation found for biometric_dialog_default_subtitle (8457232339298571992) -->
-    <skip />
+    <string name="biometric_dialog_default_subtitle" msgid="8457232339298571992">"ඉදිරියට යාමට ඔබගේ ජෛවමිතික භාවිත කරන්න"</string>
     <string name="biometric_error_hw_unavailable" msgid="2494077380540615216">"ජීවමිතික දෘඪාංග ලබා ගත නොහැකිය"</string>
     <string name="biometric_error_user_canceled" msgid="6732303949695293730">"සත්‍යාපනය අවලංගු කළා"</string>
     <string name="biometric_not_recognized" msgid="5106687642694635888">"හඳුනා නොගන්නා ලදී"</string>
     <string name="biometric_error_canceled" msgid="8266582404844179778">"සත්‍යාපනය අවලංගු කළා"</string>
     <string name="biometric_error_device_not_secured" msgid="3129845065043995924">"රහස් අංක, රටා, හෝ මුරපද කිසිවක් සකසා නැත"</string>
     <string name="biometric_error_generic" msgid="6784371929985434439">"සත්‍යාපනය කිරීමේ දෝෂයකි"</string>
-    <!-- no translation found for screen_lock_app_setting_name (6054944352976789228) -->
-    <skip />
-    <!-- no translation found for screen_lock_dialog_default_subtitle (8638638125397857315) -->
-    <skip />
+    <string name="screen_lock_app_setting_name" msgid="6054944352976789228">"තිර අගුල භාවිත කරන්න"</string>
+    <string name="screen_lock_dialog_default_subtitle" msgid="8638638125397857315">"ඉදිරියට යාමට ඔබගේ උපාංග අක්තපත්‍ර ඇතුළු කරන්න"</string>
     <string name="fingerprint_acquired_partial" msgid="8532380671091299342">"ඇඟිලි සලකුණ අඩ වශයෙන් අනාවරණය කර ගැනිණි. කරුණාකර නැවත උත්සාහ කරන්න."</string>
     <string name="fingerprint_acquired_insufficient" msgid="2545149524031515411">"ඇඟිලි සලකුණ පිරිසැකසීමට නොහැකි විය. කරුණාකර නැවත උත්සාහ කරන්න."</string>
     <string name="fingerprint_acquired_imager_dirty" msgid="4694800187151533990">"ඇඟිලි සලකුණු සංවේදකය අපිරිසිදුයි. කරුණාකර පිරිසිදු කර නැවත උත්සාහ කරන්න."</string>
@@ -589,10 +584,8 @@
     <string name="fingerprint_error_hw_not_present" msgid="578914350967423382">"මෙම උපාංගයේ ඇඟිලි සලකුණු සංවේදකයක් නොමැත."</string>
     <string name="fingerprint_error_security_update_required" msgid="7750187320640856433">"සංවේදකය තාවකාලිකව අබල කර ඇත."</string>
     <string name="fingerprint_name_template" msgid="8941662088160289778">"ඇඟිලි <xliff:g id="FINGERID">%d</xliff:g>"</string>
-    <!-- no translation found for fingerprint_app_setting_name (4253767877095495844) -->
-    <skip />
-    <!-- no translation found for fingerprint_or_screen_lock_app_setting_name (3501743523487644907) -->
-    <skip />
+    <string name="fingerprint_app_setting_name" msgid="4253767877095495844">"ඇඟිලි සලකුණ භාවිත කරන්න"</string>
+    <string name="fingerprint_or_screen_lock_app_setting_name" msgid="3501743523487644907">"ඇඟිලි සලකුණ හෝ තිර අගුල භාවිත කරන්න"</string>
     <string name="fingerprint_dialog_default_subtitle" msgid="3879832845486835905">"ඉදිරියට යාමට ඔබගේ ඇඟිලි සලකුණ භාවිත කරන්න"</string>
   <string-array name="fingerprint_error_vendor">
   </string-array>
@@ -638,12 +631,9 @@
     <string name="face_error_hw_not_present" msgid="1070600921591729944">"මෙම උපාංගයෙහි මුහුණු අඟුලු ඇරීමට සහය නොදැක්වේ"</string>
     <string name="face_error_security_update_required" msgid="5076017208528750161">"සංවේදකය තාවකාලිකව අබල කර ඇත."</string>
     <string name="face_name_template" msgid="3877037340223318119">"මුහුණු <xliff:g id="FACEID">%d</xliff:g>"</string>
-    <!-- no translation found for face_app_setting_name (8130135875458467243) -->
-    <skip />
-    <!-- no translation found for face_or_screen_lock_app_setting_name (1603149075605709106) -->
-    <skip />
-    <!-- no translation found for face_dialog_default_subtitle (4979205739418564856) -->
-    <skip />
+    <string name="face_app_setting_name" msgid="8130135875458467243">"මුහුණු අගුලු හැරීම භාවිත කරන්න"</string>
+    <string name="face_or_screen_lock_app_setting_name" msgid="1603149075605709106">"මුහුණු අගුලු හැරීම හෝ තිර අගුල භාවිත කරන්න"</string>
+    <string name="face_dialog_default_subtitle" msgid="4979205739418564856">"ඉදිරියට යාමට මුහුණු අගුලු හැරීම භාවිත කරන්න"</string>
   <string-array name="face_error_vendor">
   </string-array>
     <string name="face_icon_content_description" msgid="465030547475916280">"මුහුණ නිරූපකය"</string>
@@ -1966,8 +1956,7 @@
     <string name="app_category_news" msgid="1172762719574964544">"පුවත් සහ සඟරා"</string>
     <string name="app_category_maps" msgid="6395725487922533156">"සිතියම් සහ සංචලනය"</string>
     <string name="app_category_productivity" msgid="1844422703029557883">"ඵලදායිතාව"</string>
-    <!-- no translation found for app_category_accessibility (6643521607848547683) -->
-    <skip />
+    <string name="app_category_accessibility" msgid="6643521607848547683">"ප්‍රවේශ්‍යතාව"</string>
     <string name="device_storage_monitor_notification_channel" msgid="5164244565844470758">"උපාංග ගබඩාව"</string>
     <string name="adb_debugging_notification_channel_tv" msgid="4764046459631031496">"USB නිදොස්කරණය"</string>
     <string name="time_picker_hour_label" msgid="4208590187662336864">"පැය"</string>
diff --git a/core/tests/coretests/src/android/view/SurfaceControlFpsListenerTest.java b/core/tests/coretests/src/android/view/SurfaceControlFpsListenerTest.java
index 36104cf..c15fc3a 100644
--- a/core/tests/coretests/src/android/view/SurfaceControlFpsListenerTest.java
+++ b/core/tests/coretests/src/android/view/SurfaceControlFpsListenerTest.java
@@ -39,7 +39,7 @@
             }
         };
 
-        listener.register(new SurfaceControl());
+        listener.register(0);
 
         listener.unregister();
     }
diff --git a/media/java/android/media/MediaDrm.java b/media/java/android/media/MediaDrm.java
index f7467a6..548b415 100644
--- a/media/java/android/media/MediaDrm.java
+++ b/media/java/android/media/MediaDrm.java
@@ -558,12 +558,20 @@
         public static final int ERROR_PROVISIONING_PARSE = 26;
 
         /**
+         * The provisioning server detected an error in the provisioning
+         * request.
+         * <p>
+         * Check for errors on the provisioning server.
+         */
+        public static final int ERROR_PROVISIONING_REQUEST_REJECTED = 27;
+
+        /**
          * Provisioning failed in a way that is likely to succeed on a
          * subsequent attempt.
          * <p>
          * The app should retry the operation.
          */
-        public static final int ERROR_PROVISIONING_RETRY = 27;
+        public static final int ERROR_PROVISIONING_RETRY = 28;
 
         /**
          * This indicates that apps using MediaDrm sessions are
@@ -572,7 +580,7 @@
          * <p>
          * The app should retry the operation later.
          */
-        public static final int ERROR_RESOURCE_CONTENTION = 28;
+        public static final int ERROR_RESOURCE_CONTENTION = 29;
 
         /**
          * Failed to generate a secure stop request because a field in the
@@ -581,7 +589,7 @@
          * The secure stop can't be released on the server, but the app may
          * remove it explicitly using {@link MediaDrm#removeSecureStop}.
          */
-        public static final int ERROR_SECURE_STOP_RELEASE = 29;
+        public static final int ERROR_SECURE_STOP_RELEASE = 30;
 
         /**
          * The plugin was unable to read data from the filesystem.
@@ -589,7 +597,7 @@
          * Please see the general error handling strategy for unexpected errors
          * described in {@link ErrorCodes}.
          */
-        public static final int ERROR_STORAGE_READ = 30;
+        public static final int ERROR_STORAGE_READ = 31;
 
         /**
          * The plugin was unable to write data to the filesystem.
@@ -597,7 +605,7 @@
          * Please see the general error handling strategy for unexpected errors
          * described in {@link ErrorCodes}.
          */
-        public static final int ERROR_STORAGE_WRITE = 31;
+        public static final int ERROR_STORAGE_WRITE = 32;
 
         /**
          * {@link MediaCodec#queueSecureInputBuffer} called with 0 subsamples.
@@ -605,7 +613,7 @@
          * Check the {@link MediaCodec.CryptoInfo} object passed to {@link
          * MediaCodec#queueSecureInputBuffer}.
          */
-        public static final int ERROR_ZERO_SUBSAMPLES = 32;
+        public static final int ERROR_ZERO_SUBSAMPLES = 33;
 
     }
 
@@ -637,6 +645,7 @@
         ErrorCodes.ERROR_PROVISIONING_CERTIFICATE,
         ErrorCodes.ERROR_PROVISIONING_CONFIG,
         ErrorCodes.ERROR_PROVISIONING_PARSE,
+        ErrorCodes.ERROR_PROVISIONING_REQUEST_REJECTED,
         ErrorCodes.ERROR_PROVISIONING_RETRY,
         ErrorCodes.ERROR_SECURE_STOP_RELEASE,
         ErrorCodes.ERROR_STORAGE_READ,
diff --git a/media/java/android/media/session/MediaSessionManager.java b/media/java/android/media/session/MediaSessionManager.java
index 98a13cf..78db750 100644
--- a/media/java/android/media/session/MediaSessionManager.java
+++ b/media/java/android/media/session/MediaSessionManager.java
@@ -541,17 +541,6 @@
      * Sends a media key event. The receiver will be selected automatically.
      *
      * @param keyEvent the key event to send
-     * @hide
-     */
-    @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
-    public void dispatchMediaKeyEvent(@NonNull KeyEvent keyEvent) {
-        dispatchMediaKeyEventInternal(keyEvent, /*asSystemService=*/false, /*needWakeLock=*/false);
-    }
-
-    /**
-     * Sends a media key event. The receiver will be selected automatically.
-     *
-     * @param keyEvent the key event to send
      * @param needWakeLock true if a wake lock should be held while sending the key
      * @hide
      */
diff --git a/media/jni/android_media_MediaDrm.cpp b/media/jni/android_media_MediaDrm.cpp
index 53f6fe2..4ccbfaf 100644
--- a/media/jni/android_media_MediaDrm.cpp
+++ b/media/jni/android_media_MediaDrm.cpp
@@ -376,6 +376,7 @@
         STATUS_CASE(ERROR_DRM_PROVISIONING_CERTIFICATE);
         STATUS_CASE(ERROR_DRM_PROVISIONING_CONFIG);
         STATUS_CASE(ERROR_DRM_PROVISIONING_PARSE);
+        STATUS_CASE(ERROR_DRM_PROVISIONING_REQUEST_REJECTED);
         STATUS_CASE(ERROR_DRM_PROVISIONING_RETRY);
         STATUS_CASE(ERROR_DRM_RESOURCE_CONTENTION);
         STATUS_CASE(ERROR_DRM_SECURE_STOP_RELEASE);
diff --git a/media/jni/android_media_MediaDrm.h b/media/jni/android_media_MediaDrm.h
index dc0793a..a64e3f2 100644
--- a/media/jni/android_media_MediaDrm.h
+++ b/media/jni/android_media_MediaDrm.h
@@ -58,12 +58,13 @@
     JERROR_DRM_PROVISIONING_CERTIFICATE = 24,
     JERROR_DRM_PROVISIONING_CONFIG = 25,
     JERROR_DRM_PROVISIONING_PARSE = 26,
-    JERROR_DRM_PROVISIONING_RETRY = 27,
-    JERROR_DRM_RESOURCE_CONTENTION = 28,
-    JERROR_DRM_SECURE_STOP_RELEASE = 29,
-    JERROR_DRM_STORAGE_READ = 30,
-    JERROR_DRM_STORAGE_WRITE = 31,
-    JERROR_DRM_ZERO_SUBSAMPLES = 32,
+    JERROR_DRM_PROVISIONING_REQUEST_REJECTED = 27,
+    JERROR_DRM_PROVISIONING_RETRY = 28,
+    JERROR_DRM_RESOURCE_CONTENTION = 29,
+    JERROR_DRM_SECURE_STOP_RELEASE = 30,
+    JERROR_DRM_STORAGE_READ = 31,
+    JERROR_DRM_STORAGE_WRITE = 32,
+    JERROR_DRM_ZERO_SUBSAMPLES = 33,
 };
 
 struct ListenerArgs {
diff --git a/packages/InputDevices/res/values-eu/strings.xml b/packages/InputDevices/res/values-eu/strings.xml
index 513eba2..64628a82 100644
--- a/packages/InputDevices/res/values-eu/strings.xml
+++ b/packages/InputDevices/res/values-eu/strings.xml
@@ -41,13 +41,13 @@
     <string name="keyboard_layout_arabic" msgid="5671970465174968712">"Arabiarra"</string>
     <string name="keyboard_layout_greek" msgid="7289253560162386040">"Greziarra"</string>
     <string name="keyboard_layout_hebrew" msgid="7241473985890173812">"Hebrearra"</string>
-    <string name="keyboard_layout_lithuanian" msgid="6943110873053106534">"Lituaniera"</string>
+    <string name="keyboard_layout_lithuanian" msgid="6943110873053106534">"Lituaniarra"</string>
     <string name="keyboard_layout_spanish_latin" msgid="5690539836069535697">"Espainiarra (Latinoamerika)"</string>
-    <string name="keyboard_layout_latvian" msgid="4405417142306250595">"Letoniera"</string>
+    <string name="keyboard_layout_latvian" msgid="4405417142306250595">"Letoniarra"</string>
     <string name="keyboard_layout_persian" msgid="3920643161015888527">"Persiarra"</string>
     <string name="keyboard_layout_azerbaijani" msgid="7315895417176467567">"Azerbaijandarra"</string>
     <string name="keyboard_layout_polish" msgid="1121588624094925325">"Poloniarra"</string>
-    <string name="keyboard_layout_belarusian" msgid="7619281752698687588">"Bielorrusiera"</string>
+    <string name="keyboard_layout_belarusian" msgid="7619281752698687588">"Bielorrusiarra"</string>
     <string name="keyboard_layout_mongolian" msgid="7678483495823936626">"Mongoliarra"</string>
-    <string name="keyboard_layout_georgian" msgid="4596185456863747454">"Georgiera"</string>
+    <string name="keyboard_layout_georgian" msgid="4596185456863747454">"Georgiarra"</string>
 </resources>