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

Commit 75157d77 authored by Yunfan Chen's avatar Yunfan Chen
Browse files

Introduce process configuration to WindowProcessController

Introduced the process config and adjusted mergedconfiguration
related calls. Such that we can override configuration for a process
when need to.

The potential use cases include:
1. Maintain process window bounds for the latest activity to override
the display info for legacy apps;
2. Override the display info for IME process to make sure the IME can be
shown with the correct display metrics.

ActivityManagerService:
- Use process configuration instead of the global configuration when
  it's for app.

ActivityStackSupervisor:
- Use process configuration when start activity.

WindowProcessController:
- Make it a ConfigurationContainer.

ActivityTaskManagerService:
- Add interface to get configuration for a process. If the process is a
  system process or non-existing process, return the global
  configuration.
- Return device configuration related to the process.
- Propagate configuration updates from Global to Process.

ActivityTaskManagerInternal:
- API to update configuration for IME process.

WindowManagerService/WindowManagerInternal:
- Propagate the process configuration change to wm.

WindowState:
- Use process configuration instead of global.

Test: go/wm-smoke
Test: servicestests will remain the same result as without this patch.
Bug: 113253755

Change-Id: I3660723352d2e8779d40528ae92d71f59ddbf1f1
parent af8f3fcf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3379,7 +3379,7 @@ public class ActivityManager {
     */
    public ConfigurationInfo getDeviceConfigurationInfo() {
        try {
            return getService().getDeviceConfigurationInfo();
            return getTaskService().getDeviceConfigurationInfo();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
+0 −2
Original line number Diff line number Diff line
@@ -208,8 +208,6 @@ interface IActivityManager {
    List<ActivityManager.RunningServiceInfo> getServices(int maxNum, int flags);
    // Retrieve running application processes in the system
    List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses();
    // Get device configuration
    ConfigurationInfo getDeviceConfigurationInfo();
    IBinder peekService(in Intent service, in String resolvedType, in String callingPackage);
    // Turn on/off profiling in a particular process.
    boolean profileControl(in String process, int userId, boolean start,
+3 −0
Original line number Diff line number Diff line
@@ -344,6 +344,9 @@ interface IActivityTaskManager {
    void notifyPinnedStackAnimationStarted();
    void notifyPinnedStackAnimationEnded();

    // Get device configuration
    ConfigurationInfo getDeviceConfigurationInfo();

    /**
     * Resizes the pinned stack.
     *
+7 −30
Original line number Diff line number Diff line
@@ -5895,7 +5895,8 @@ public class ActivityManagerService extends IActivityManager.Stub
                                 PackageManager.NOTIFY_PACKAGE_USE_INSTRUMENTATION);
            }
            if (DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION, "Binding proc "
                    + processName + " with config " + getGlobalConfiguration());
                    + processName + " with config "
                    + app.getWindowProcessController().getConfiguration());
            ApplicationInfo appInfo = instr != null ? instr.mTargetInfo : app.info;
            app.compat = compatibilityInfoForPackage(appInfo);
@@ -6008,8 +6009,8 @@ public class ActivityManagerService extends IActivityManager.Stub
                        instr2.mUiAutomationConnection, testMode,
                        mBinderTransactionTrackingEnabled, enableTrackAllocation,
                        isRestrictedBackupMode || !normalMode, app.isPersistent(),
                        new Configuration(getGlobalConfiguration()), app.compat,
                        getCommonServicesLocked(app.isolated),
                        new Configuration(app.getWindowProcessController().getConfiguration()),
                        app.compat, getCommonServicesLocked(app.isolated),
                        mCoreSettingsObserver.getCoreSettingsLocked(),
                        buildSerial, isAutofillCompatEnabled);
            } else {
@@ -6017,8 +6018,8 @@ public class ActivityManagerService extends IActivityManager.Stub
                        null, null, null, testMode,
                        mBinderTransactionTrackingEnabled, enableTrackAllocation,
                        isRestrictedBackupMode || !normalMode, app.isPersistent(),
                        new Configuration(getGlobalConfiguration()), app.compat,
                        getCommonServicesLocked(app.isolated),
                        new Configuration(app.getWindowProcessController().getConfiguration()),
                        app.compat, getCommonServicesLocked(app.isolated),
                        mCoreSettingsObserver.getCoreSettingsLocked(),
                        buildSerial, isAutofillCompatEnabled);
            }
@@ -8718,7 +8719,7 @@ public class ActivityManagerService extends IActivityManager.Stub
            StatsLog.write(StatsLog.ISOLATED_UID_CHANGED, info.uid, uid,
                    StatsLog.ISOLATED_UID_CHANGED__EVENT__CREATED);
        }
        final ProcessRecord r = new ProcessRecord(this, info, proc, uid);
        final ProcessRecord r = new ProcessRecord(this, info, proc, uid, getGlobalConfiguration());
        if (!mBooted && !mBooting
                && userId == UserHandle.USER_SYSTEM
                && (info.flags & PERSISTENT_MASK) == PERSISTENT_MASK) {
@@ -17082,30 +17083,6 @@ public class ActivityManagerService extends IActivityManager.Stub
        }
    }
    // =========================================================
    // CONFIGURATION
    // =========================================================
    public ConfigurationInfo getDeviceConfigurationInfo() {
        ConfigurationInfo config = new ConfigurationInfo();
        synchronized (this) {
            final Configuration globalConfig = getGlobalConfiguration();
            config.reqTouchScreen = globalConfig.touchscreen;
            config.reqKeyboardType = globalConfig.keyboard;
            config.reqNavigation = globalConfig.navigation;
            if (globalConfig.navigation == Configuration.NAVIGATION_DPAD
                    || globalConfig.navigation == Configuration.NAVIGATION_TRACKBALL) {
                config.reqInputFeatures |= ConfigurationInfo.INPUT_FEATURE_FIVE_WAY_NAV;
            }
            if (globalConfig.keyboard != Configuration.KEYBOARD_UNDEFINED
                    && globalConfig.keyboard != Configuration.KEYBOARD_NOKEYS) {
                config.reqInputFeatures |= ConfigurationInfo.INPUT_FEATURE_HARD_KEYBOARD;
            }
            config.reqGlEsVersion = GL_ES_VERSION;
        }
        return config;
    }
    @Override
    public StackInfo getFocusedStackInfo() throws RemoteException {
        return mActivityTaskManager.getFocusedStackInfo();
+6 −1
Original line number Diff line number Diff line
@@ -2063,7 +2063,12 @@ final class ActivityManagerShellCommand extends ShellCommand {
            pw.print("has-secure-screen-lock: "); pw.println(kgm.isDeviceSecure());
        }

        ConfigurationInfo configInfo = mInternal.getDeviceConfigurationInfo();
        ConfigurationInfo configInfo = null;
        try {
            configInfo = mTaskInterface.getDeviceConfigurationInfo();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
        if (configInfo.reqGlEsVersion != ConfigurationInfo.GL_ES_VERSION_UNDEFINED) {
            if (protoOutputStream != null) {
                protoOutputStream.write(DeviceConfigurationProto.OPENGL_VERSION,
Loading