Bootstrap freeform external displays.

To get freeform external display one can:
1. Enable freeform windows in developer options;
2. Reboot the device;
3. Connect an external device.

All tasks launched in the external display are then launched in freeform
mode by default, and centered in that display.

There are a lot to do after this CL. It needs caption and window decor
so it can be maximized, restored, drag-moved and drag-resized. There is
no system UI on external display yet so we can't launch arbitrary
activities on it, nor can we minimize anything.

I'm using ActivityView for testing and it uses input forwarder, but we
need to solve the use of mouse and keyboard when it goes to a real
external display.

In addition, tightened the visibility of DisplaySettings class.

Bug: 111840884
Test: go/wm-smoke
Test: activity launching on external freeform displays.
Test: atest DisplaySettingsTests
Change-Id: Ie2a05110ada60b054ac35dae948ad309ea378b1c
diff --git a/services/core/java/com/android/server/am/ActivityTaskManagerService.java b/services/core/java/com/android/server/am/ActivityTaskManagerService.java
index 3b3263c..bd502df 100644
--- a/services/core/java/com/android/server/am/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityTaskManagerService.java
@@ -27,6 +27,7 @@
 import static android.Manifest.permission.START_TASKS_FROM_RECENTS;
 import static android.Manifest.permission.STOP_APP_SWITCHES;
 import static android.app.ActivityManager.LOCK_TASK_MODE_NONE;
+import static android.content.pm.PackageManager.FEATURE_PC;
 import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER;
 import static android.provider.Settings.Global.HIDE_ERROR_DIALOGS;
 import static android.provider.Settings.System.FONT_SCALE;
@@ -541,6 +542,7 @@
         final boolean forceRtl = Settings.Global.getInt(resolver, DEVELOPMENT_FORCE_RTL, 0) != 0;
         final boolean forceResizable = Settings.Global.getInt(
                 resolver, DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES, 0) != 0;
+        final boolean isPc = mContext.getPackageManager().hasSystemFeature(FEATURE_PC);
 
         // Transfer any global setting for forcing RTL layout, into a System Property
         SystemProperties.set(DEVELOPMENT_FORCE_RTL, forceRtl ? "1":"0");
@@ -573,6 +575,8 @@
             }
             mWindowManager.setForceResizableTasks(mForceResizableActivities);
             mWindowManager.setSupportsPictureInPicture(mSupportsPictureInPicture);
+            mWindowManager.setSupportsFreeformWindowManagement(mSupportsFreeformWindowManagement);
+            mWindowManager.setIsPc(isPc);
             // This happens before any activities are started, so we can change global configuration
             // in-place.
             updateConfigurationLocked(configuration, null, true);