blob: 908142714c5e5da504612bfe06db5aa019f67b3d [file] [log] [blame]
Pierre-Hugues Husson0406a1d2018-08-29 22:47:54 +02001From c5614e24c92589437b8737b3ac39f7d43e4bd61e Mon Sep 17 00:00:00 2001
2From: Pierre-Hugues Husson <phh@phh.me>
3Date: Wed, 29 Aug 2018 11:05:54 +0200
4Subject: [PATCH 23/24] Add a property to override pre-o max aspect ratio
5
6---
7 services/core/java/com/android/server/am/ActivityRecord.java | 9 ++++++++-
8 1 file changed, 8 insertions(+), 1 deletion(-)
9
10diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
11index 75f2723..28f6eae 100644
12--- a/services/core/java/com/android/server/am/ActivityRecord.java
13+++ b/services/core/java/com/android/server/am/ActivityRecord.java
14@@ -163,6 +163,7 @@ import android.os.PersistableBundle;
15 import android.os.Process;
16 import android.os.RemoteException;
17 import android.os.SystemClock;
18+import android.os.SystemProperties;
19 import android.os.Trace;
20 import android.os.UserHandle;
21 import android.os.storage.StorageManager;
22@@ -2421,7 +2422,7 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo
23 // TODO(b/36505427): Consider moving this method and similar ones to ConfigurationContainer.
24 private void computeBounds(Rect outBounds) {
25 outBounds.setEmpty();
26- final float maxAspectRatio = info.maxAspectRatio;
27+ float maxAspectRatio = info.maxAspectRatio;
28 final ActivityStack stack = getStack();
29 if (task == null || stack == null || task.inMultiWindowMode() || maxAspectRatio == 0
30 || isInVrUiMode(getConfiguration())) {
31@@ -2432,6 +2433,12 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo
32 return;
33 }
34
35+ if(info.applicationInfo.targetSdkVersion < O) {
36+ try {
37+ maxAspectRatio = Float.parseFloat(SystemProperties.get("persist.sys.max_aspect_ratio.pre_o", ""));
38+ } catch (Throwable t) {}
39+ Log.d("PHH", "Overrode aspect ratio because pre-o to " + maxAspectRatio);
40+ }
41 // We must base this on the parent configuration, because we set our override
42 // configuration's appBounds based on the result of this method. If we used our own
43 // configuration, it would be influenced by past invocations.
44--
452.7.4
46