Add permission to modify user preferred display mode.

This permission will be used for testing purposes to modify the user
prefrred mode.

Ignore-AOSP-First: There are merge conflicts in master. So uploading to
master.

Bug: 198452789
Test: m
Change-Id: Id17e20f93ca9db4a24245e8c38f62d95b4f0f4ce
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index 681949a..b225f5b 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -26,6 +26,7 @@
     field public static final String MANAGE_ROLLBACKS = "android.permission.MANAGE_ROLLBACKS";
     field public static final String MANAGE_TOAST_RATE_LIMITING = "android.permission.MANAGE_TOAST_RATE_LIMITING";
     field public static final String MODIFY_REFRESH_RATE_SWITCHING_TYPE = "android.permission.MODIFY_REFRESH_RATE_SWITCHING_TYPE";
+    field public static final String MODIFY_USER_PREFERRED_DISPLAY_MODE = "android.permission.MODIFY_USER_PREFERRED_DISPLAY_MODE";
     field public static final String NETWORK_SETTINGS = "android.permission.NETWORK_SETTINGS";
     field public static final String NETWORK_STACK = "android.permission.NETWORK_STACK";
     field public static final String OVERRIDE_DISPLAY_MODE_REQUESTS = "android.permission.OVERRIDE_DISPLAY_MODE_REQUESTS";
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 4f8b317..612dfd0 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -4494,6 +4494,12 @@
     <permission android:name="android.permission.MODIFY_REFRESH_RATE_SWITCHING_TYPE"
                 android:protectionLevel="signature" />
 
+    <!-- Allows an application to modify the user preferred display mode.
+         @hide
+         @TestApi -->
+    <permission android:name="android.permission.MODIFY_USER_PREFERRED_DISPLAY_MODE"
+                android:protectionLevel="signature" />
+
     <!-- @SystemApi Allows an application to control VPN.
          <p>Not for use by third-party applications.</p>
          @hide -->
diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml
index 7f0c5d4..7d06620 100644
--- a/packages/Shell/AndroidManifest.xml
+++ b/packages/Shell/AndroidManifest.xml
@@ -460,6 +460,9 @@
     <!-- Permission needed for CTS test - MatchContentFrameRateTest -->
     <uses-permission android:name="android.permission.MODIFY_REFRESH_RATE_SWITCHING_TYPE" />
 
+    <!-- Permission needed for CTS test - DefaultDisplayModeTest -->
+    <uses-permission android:name="android.permission.MODIFY_USER_PREFERRED_DISPLAY_MODE" />
+
     <!-- Permissions needed for CTS test - TimeManagerTest -->
     <uses-permission android:name="android.permission.MANAGE_TIME_AND_ZONE_DETECTION" />
     <uses-permission android:name="android.permission.SUGGEST_EXTERNAL_TIME" />