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

Commit 80130cbc authored by Jesse Chan's avatar Jesse Chan Committed by Sam Mortimer
Browse files

Add an option to force pre-O apps to use full screen aspect ratio

When an app target pre-O releases, the default max aspect ratio
is 1.86:1 which leads to ugly black areas on devices that have
screens with higher aspect ratio (for example Galaxy S8/S9).

This change adds an option to allow users to change aspect ratio
for pre-O apps to full screen aspect ratio.

Change-Id: I41d5408841593a12443be885e11959bffaebb67b
parent e1db6015
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -412,6 +412,8 @@ import com.android.server.vr.VrManagerInternal;
import com.android.server.wm.PinnedStackWindowController;
import com.android.server.wm.WindowManagerService;
import org.lineageos.internal.applications.LineageActivityManager;
import java.text.SimpleDateFormat;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -1737,6 +1739,9 @@ public class ActivityManagerService extends IActivityManager.Stub
    private static String sTheRealBuildSerial = Build.UNKNOWN;
    // Lineage sdk activity related helper
    private LineageActivityManager mLineageActivityManager;
    /**
     * Current global configuration information. Contains general settings for the entire system,
     * also corresponds to the merged configuration of the default display.
@@ -12221,6 +12226,10 @@ public class ActivityManagerService extends IActivityManager.Stub
        RescueParty.onSettingsProviderPublished(mContext);
        //mUsageStatsService.monitorPackages();
        // LineageActivityManager depends on settings so we can initialize only
        // after providers are available.
        mLineageActivityManager = new LineageActivityManager(mContext);
    }
    private void startPersistentApps(int matchFlags) {
@@ -24748,4 +24757,8 @@ public class ActivityManagerService extends IActivityManager.Stub
            }
        }
    }
    public boolean shouldForceLongScreen(String packageName) {
        return mLineageActivityManager.shouldForceLongScreen(packageName);
    }
}
+3 −1
Original line number Diff line number Diff line
@@ -2334,7 +2334,9 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo
        int maxActivityWidth = containingAppWidth;
        int maxActivityHeight = containingAppHeight;

        if (containingAppWidth < containingAppHeight) {
        if (service.shouldForceLongScreen(packageName)) {
            // Use containingAppWidth/Height for maxActivityWidth/Height when force long screen
        } else if (containingAppWidth < containingAppHeight) {
            // Width is the shorter side, so we use that to figure-out what the max. height
            // should be given the aspect ratio.
            maxActivityHeight = (int) ((maxActivityWidth * maxAspectRatio) + 0.5f);