diff options
author | 2015-10-22 12:50:31 +0200 | |
---|---|---|
committer | 2015-10-27 08:18:36 -0700 | |
commit | 8ccdf3ac49b658737b8106bc921347a3d3e3bbbc (patch) | |
tree | f215b36d6b102902f437aca8e531d5757ce7160e | |
parent | 75b2597e5826662c1740d6f3b81966a9e6a9e7b4 (diff) |
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
4 files changed, 22 insertions, 17 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 11effd040ab6..a1f9743d4d4e 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -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. */ diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java index d3559bc375ca..221af1540238 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java +++ b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java @@ -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; diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 983475734a25..257f0343b292 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -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); diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java index 090a34247f04..120b40c73c13 100644 --- a/services/core/java/com/android/server/am/TaskRecord.java +++ b/services/core/java/com/android/server/am/TaskRecord.java @@ -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; |