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

Unverified Commit 0198ea53 authored by Jesse Chan's avatar Jesse Chan Committed by Michael Bestas
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 039169e3
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -9317,7 +9317,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        int activityHeight = containingAppHeight;

        if (containingRatio - desiredAspectRatio > ASPECT_RATIO_ROUNDING_TOLERANCE) {
            if (containingAppWidth < containingAppHeight) {
            if (mAtmService.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.
                activityHeight = (int) ((activityWidth * desiredAspectRatio) + 0.5f);
+13 −0
Original line number Diff line number Diff line
@@ -280,6 +280,8 @@ import com.android.server.uri.NeededUriGrants;
import com.android.server.uri.UriGrantsManagerInternal;
import com.android.server.wallpaper.WallpaperManagerInternal;

import org.lineageos.internal.applications.LineageActivityManager;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileDescriptor;
@@ -790,6 +792,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {

    private Set<Integer> mProfileOwnerUids = new ArraySet<Integer>();

    // Lineage sdk activity related helper
    private LineageActivityManager mLineageActivityManager;

    private final class SettingObserver extends ContentObserver {
        private final Uri mFontScaleUri = Settings.System.getUriFor(FONT_SCALE);
        private final Uri mHideErrorDialogsUri = Settings.Global.getUriFor(HIDE_ERROR_DIALOGS);
@@ -887,6 +892,10 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {

    public void installSystemProviders() {
        mSettingsObserver = new SettingObserver();

        // LineageActivityManager depends on settings so we can initialize only
        // after providers are available.
        mLineageActivityManager = new LineageActivityManager(mContext);
    }

    public void retrieveSettings(ContentResolver resolver) {
@@ -7141,4 +7150,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
            ActivityTaskManagerService.this.unregisterTaskStackListener(listener);
        }
    }

    public boolean shouldForceLongScreen(String packageName) {
        return mLineageActivityManager.shouldForceLongScreen(packageName);
    }
}