Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f2efd3d authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Add developer option for freeform window support (1/2)

Also disable default force-resizable on non-user builds.

Bug: 25276672
Bug: 24815256
Bug: 26294625
Bug: 26294534
Change-Id: I5b31e494c993d2d9dad175b94b4f30637e8f3718
parent a6c934e2
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -6374,6 +6374,13 @@ public final class Settings {
        public static final String DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES
                = "force_resizable_activities";

        /**
         * Whether to enable experimental freeform support for windows.
         * @hide
         */
        public static final String DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT
                = "enable_freeform_support";

       /**
        * Whether user has enabled development settings.
        */
+5 −0
Original line number Diff line number Diff line
@@ -624,6 +624,11 @@
    <!-- UI debug setting: force allow on external summary [CHAR LIMIT=150] -->
    <string name="force_resizable_activities_summary">Makes all activities resizable for multi-window, regardless of manifest values.</string>

    <!-- UI debug setting: enable freeform window support [CHAR LIMIT=50] -->
    <string name="enable_freeform_support">Enable freeform windows</string>
    <!-- UI debug setting: enable freeform window support summary [CHAR LIMIT=150] -->
    <string name="enable_freeform_support_summary">Enables support for experimental freeform windows.</string>

    <!-- Local (desktop) backup password menu title [CHAR LIMIT=25] -->
    <string name="local_backup_password_title">Desktop backup password</string>
    <!-- Summary text of the "local backup password" setting when the user has not supplied a password -->
+4 −1
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.HOME_STACK_ID;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT;

/**
 * Acts as a shim around the real system services that we need to access data from, and provides
@@ -128,7 +129,9 @@ public class SystemServicesProxy {
        mDisplay = mWm.getDefaultDisplay();
        mRecentsPackage = context.getPackageName();
        mHasFreeformWorkspaceSupport =
                mPm.hasSystemFeature(PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT);
                mPm.hasSystemFeature(PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT) ||
                        Settings.Global.getInt(context.getContentResolver(),
                                DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT, 0) != 0;

        // Get the dummy thumbnail width/heights
        Resources res = context.getResources();
+5 −3
Original line number Diff line number Diff line
@@ -258,6 +258,7 @@ import static android.content.pm.PackageManager.FEATURE_PICTURE_IN_PICTURE;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.provider.Settings.Global.ALWAYS_FINISH_ACTIVITIES;
import static android.provider.Settings.Global.DEBUG_APP;
import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT;
import static android.provider.Settings.Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES;
import static android.provider.Settings.Global.DEVELOPMENT_FORCE_RTL;
import static android.provider.Settings.Global.WAIT_FOR_DEBUGGER;
@@ -12204,7 +12205,9 @@ public final class ActivityManagerService extends ActivityManagerNative
    private void retrieveSettings() {
        final ContentResolver resolver = mContext.getContentResolver();
        final boolean freeformWindowManagement =
                mContext.getPackageManager().hasSystemFeature(FEATURE_FREEFORM_WINDOW_MANAGEMENT);
                mContext.getPackageManager().hasSystemFeature(FEATURE_FREEFORM_WINDOW_MANAGEMENT)
                        || Settings.Global.getInt(
                                resolver, DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT, 0) != 0;
        final boolean supportsPictureInPicture =
                mContext.getPackageManager().hasSystemFeature(FEATURE_PICTURE_IN_PICTURE);
@@ -12213,9 +12216,8 @@ public final class ActivityManagerService extends ActivityManagerNative
        final boolean alwaysFinishActivities =
                Settings.Global.getInt(resolver, ALWAYS_FINISH_ACTIVITIES, 0) != 0;
        final boolean forceRtl = Settings.Global.getInt(resolver, DEVELOPMENT_FORCE_RTL, 0) != 0;
        final int defaultForceResizable = Build.IS_DEBUGGABLE ? 1 : 0;
        final boolean forceResizable = Settings.Global.getInt(
                resolver, DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES, defaultForceResizable) != 0;
                resolver, DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES, 0) != 0;
        // Transfer any global setting for forcing RTL layout, into a System Property
        SystemProperties.set(DEVELOPMENT_FORCE_RTL, forceRtl ? "1":"0");