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

Commit 034ec49b authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Persist configuration for the calling or current user

Persist the font size change to the correct user.

Bug: 30273473
Change-Id: Ia29735d4112720389a30b61f961f6c1071ce4ba2
parent e86da3bc
Loading
Loading
Loading
Loading
+15 −10
Original line number Diff line number Diff line
@@ -1086,9 +1086,9 @@ public final class ActivityManagerService extends ActivityManagerNative
        }
        @Override
        public void onChange(boolean selfChange, Uri uri) {
        public void onChange(boolean selfChange, Uri uri, @UserIdInt int userId) {
            if (mFontScaleUri.equals(uri)) {
                updateFontScaleIfNeeded();
                updateFontScaleIfNeeded(userId);
            }
        }
    }
@@ -18681,23 +18681,28 @@ public final class ActivityManagerService extends ActivityManagerNative
        int userId = UserHandle.getCallingUserId();
        synchronized(this) {
            updatePersistentConfigurationLocked(values, userId);
        }
    }
    private void updatePersistentConfigurationLocked(Configuration values, @UserIdInt int userId) {
        final long origId = Binder.clearCallingIdentity();
        try {
            updateConfigurationLocked(values, null, false, true, userId, false /* deferResume */);
        } finally {
            Binder.restoreCallingIdentity(origId);
        }
    }
    private void updateFontScaleIfNeeded() {
        final int currentUserId;
        synchronized(this) {
            currentUserId = mUserController.getCurrentUserIdLocked();
        }
    private void updateFontScaleIfNeeded(@UserIdInt int userId) {
        final float scaleFactor = Settings.System.getFloatForUser(mContext.getContentResolver(),
                FONT_SCALE, 1.0f, currentUserId);
                FONT_SCALE, 1.0f, userId);
        if (mConfiguration.fontScale != scaleFactor) {
            final Configuration configuration = mWindowManager.computeNewConfiguration();
            configuration.fontScale = scaleFactor;
            updatePersistentConfiguration(configuration);
            synchronized (this) {
                updatePersistentConfigurationLocked(configuration, userId);
            }
        }
    }