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

Commit 789dadf4 authored by Jesse Chan's avatar Jesse Chan Committed by Bruno Martins
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 b4bb64ed
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -478,6 +478,8 @@ import libcore.util.EmptyArray;
import com.google.android.collect.Lists;
import com.google.android.collect.Maps;
import org.lineageos.internal.applications.LineageActivityManager;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;
@@ -1988,6 +1990,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.
@@ -12892,6 +12897,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);
    }
    void startPersistentApps(int matchFlags) {
@@ -27188,4 +27197,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
@@ -2441,7 +2441,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);