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

Commit 8ccdf3ac authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Add development option to force everything resizable

Add a development setting to force all activites to be
resizable. Currently, a restart is required after changing
this setting. Also remove all the code that forced a single
task to be resizable, as we have a global option now.

Bug: 24815256
Change-Id: I3237c9b6ce96ff9aa9819592ab0c2807fde88dc4
parent 75b2597e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -6277,6 +6277,15 @@ public final class Settings {
        */
       public static final String FORCE_ALLOW_ON_EXTERNAL = "force_allow_on_external";

        /**
         * Whether any activity can be resized. When this is true, any
         * activity, regardless of manifest values, can be resized for multi-window.
         * (0 = false, 1 = true)
         * @hide
         */
        public static final String DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES
                = "force_resizable_activities";

       /**
        * Whether user has enabled development settings.
        */
+0 −13
Original line number Diff line number Diff line
@@ -266,17 +266,6 @@ public class SystemServicesProxy {
        return null;
    }

    /** Allow a task to resize. */
    public void setTaskResizeable(int taskId) {
        if (mIam == null) return;

        try {
            mIam.setTaskResizeable(taskId, true);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }

    /**
     * Resizes the given task to the new bounds.
     */
@@ -746,8 +735,6 @@ public class SystemServicesProxy {
            ActivityOptions options) {
        if (mIam != null) {
            try {
                // TODO: Remove when compatibility story is figured out.
                setTaskResizeable(taskId);
                mIam.startActivityFromRecents(
                        taskId, INVALID_STACK_ID, options == null ? null : options.toBundle());
                return true;
+8 −2
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ import android.os.WorkSource;
import android.os.storage.IMountService;
import android.os.storage.MountServiceInternal;
import android.os.storage.StorageManager;
import android.provider.Settings.Global;
import android.service.voice.IVoiceInteractionSession;
import android.service.voice.VoiceInteractionSession;
import android.util.ArrayMap;
@@ -1189,6 +1190,7 @@ public final class ActivityManagerService extends ActivityManagerNative
    String mOrigDebugApp = null;
    boolean mOrigWaitForDebugger = false;
    boolean mAlwaysFinishActivities = false;
    boolean mForceResizableActivites;
    IActivityController mController = null;
    String mProfileApp = null;
    ProcessRecord mProfileProc = null;
@@ -11638,14 +11640,17 @@ public final class ActivityManagerService extends ActivityManagerNative
    private void retrieveSettings() {
        final ContentResolver resolver = mContext.getContentResolver();
        String debugApp = Settings.Global.getString(
            resolver, Settings.Global.DEBUG_APP);
        String debugApp = Settings.Global.getString(resolver, Settings.Global.DEBUG_APP);
        boolean waitForDebugger = Settings.Global.getInt(
            resolver, Settings.Global.WAIT_FOR_DEBUGGER, 0) != 0;
        boolean alwaysFinishActivities = Settings.Global.getInt(
            resolver, Settings.Global.ALWAYS_FINISH_ACTIVITIES, 0) != 0;
        boolean forceRtl = Settings.Global.getInt(
                resolver, Settings.Global.DEVELOPMENT_FORCE_RTL, 0) != 0;
        int defaultForceResizable = Build.IS_DEBUGGABLE ? 1 : 0;
        boolean forceResizable = Settings.Global.getInt(
                resolver, Global.DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES,
                defaultForceResizable) != 0;
        // Transfer any global setting for forcing RTL layout, into a System Property
        SystemProperties.set(Settings.Global.DEVELOPMENT_FORCE_RTL, forceRtl ? "1":"0");
@@ -11660,6 +11665,7 @@ public final class ActivityManagerService extends ActivityManagerNative
            mDebugApp = mOrigDebugApp = debugApp;
            mWaitForDebugger = mOrigWaitForDebugger = waitForDebugger;
            mAlwaysFinishActivities = alwaysFinishActivities;
            mForceResizableActivites = forceResizable;
            // This happens before any activities are started, so we can
            // change mConfiguration in-place.
            updateConfigurationLocked(configuration, null, true);
+5 −2
Original line number Diff line number Diff line
@@ -318,7 +318,7 @@ final class TaskRecord {
        mNextAffiliateTaskId = nextTaskId;
        mCallingUid = callingUid;
        mCallingPackage = callingPackage;
        mResizeable = resizeable;
        mResizeable = resizeable || mService.mForceResizableActivites;
        mPrivileged = privileged;
        ActivityInfo info = mActivities.get(0).info;
        mMinimalSize = info != null && info.layout != null ? info.layout.minimalSize : -1;
@@ -420,7 +420,7 @@ final class TaskRecord {
        } else {
            autoRemoveRecents = false;
        }
        mResizeable = info.resizeable;
        mResizeable = info.resizeable || mService.mForceResizableActivites;
        mLockTaskMode = info.lockTaskLaunchMode;
        mPrivileged = (info.applicationInfo.privateFlags & PRIVATE_FLAG_PRIVILEGED) != 0;
        setLockTaskAuth();
@@ -626,6 +626,9 @@ final class TaskRecord {
        // Only set this based on the first activity
        if (mActivities.isEmpty()) {
            taskType = r.mActivityType;
            if (taskType == HOME_ACTIVITY_TYPE && mService.mForceResizableActivites) {
                mResizeable = r.info.resizeable;
            }
            isPersistable = r.isPersistable();
            mCallingUid = r.launchedFromUid;
            mCallingPackage = r.launchedFromPackage;