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

Commit 7853ba63 authored by Amith Yamasani's avatar Amith Yamasani Committed by Android (Google) Code Review
Browse files

Merge "Persist configuration for the calling or current user" into nyc-mr1-dev

parents 6da66578 034ec49b
Loading
Loading
Loading
Loading
+15 −10
Original line number Diff line number Diff line
@@ -1087,9 +1087,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);
            }
        }
    }
@@ -18722,23 +18722,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);
            }
        }
    }