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

Commit dc2722a5 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 7804438 from 373ed012 to sc-qpr1-d-release

Change-Id: Ie3606f9b3df9d455d86f17efede6e9321bd7c8eb
parents 19a97a82 373ed012
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -155,7 +155,7 @@
    <string name="running_process_item_user_label" msgid="3988506293099805796">"ଉପଯୋଗକର୍ତ୍ତା: <xliff:g id="USER_NAME">%1$s</xliff:g>"</string>
    <string name="launch_defaults_some" msgid="3631650616557252926">"କିଛି ପୂର୍ବ-ନିର୍ଦ୍ଧାରିତ ମାନ ସେଟ୍‌ ହୋଇଛି"</string>
    <string name="launch_defaults_none" msgid="8049374306261262709">"କୌଣସି ଡିଫଲ୍ଟ ସେଟ୍‍ ହୋଇନାହିଁ"</string>
    <string name="tts_settings" msgid="8130616705989351312">"ଟେକ୍ସଟ-ରୁ-ସ୍ପିଚ୍ ସେଟିଂସ"</string>
    <string name="tts_settings" msgid="8130616705989351312">"ଟେକ୍ସଟ୍-ଟୁ-ସ୍ପିଚ୍ ସେଟିଂସ"</string>
    <string name="tts_settings_title" msgid="7602210956640483039">"ଟେକ୍ସଟ୍‍-ଟୁ-ସ୍ପିଚ୍‍ ଆଉଟ୍‍ପୁଟ୍‌"</string>
    <string name="tts_default_rate_title" msgid="3964187817364304022">"ସ୍ପିଚ୍‌ ରେଟ୍"</string>
    <string name="tts_default_rate_summary" msgid="3781937042151716987">"ଲେଖା ପଢ଼ିବାର ବେଗ"</string>
+7 −6
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import static android.hardware.SensorPrivacyManager.Sources.OTHER;
import static android.hardware.SensorPrivacyManager.Sources.QS_TILE;
import static android.hardware.SensorPrivacyManager.Sources.SETTINGS;
import static android.hardware.SensorPrivacyManager.Sources.SHELL;
import static android.os.UserHandle.USER_NULL;
import static android.os.UserHandle.USER_SYSTEM;
import static android.service.SensorPrivacyIndividualEnabledSensorProto.UNKNOWN;

@@ -195,7 +196,7 @@ public final class SensorPrivacyService extends SystemService {
    private EmergencyCallHelper mEmergencyCallHelper;
    private KeyguardManager mKeyguardManager;

    private int mCurrentUser = -1;
    private int mCurrentUser = USER_NULL;

    public SensorPrivacyService(Context context) {
        super(context);
@@ -228,9 +229,9 @@ public final class SensorPrivacyService extends SystemService {

    @Override
    public void onUserStarting(TargetUser user) {
        if (mCurrentUser == -1) {
        if (mCurrentUser == USER_NULL) {
            mCurrentUser = user.getUserIdentifier();
            mSensorPrivacyServiceImpl.userSwitching(-1, user.getUserIdentifier());
            mSensorPrivacyServiceImpl.userSwitching(USER_NULL, user.getUserIdentifier());
        }
    }

@@ -1294,13 +1295,13 @@ public final class SensorPrivacyService extends SystemService {
                micState = isIndividualSensorPrivacyEnabledLocked(to, MICROPHONE);
                camState = isIndividualSensorPrivacyEnabledLocked(to, CAMERA);
            }
            if (prevMicState != micState) {
            if (from == USER_NULL || prevMicState != micState) {
                mHandler.onUserGlobalSensorPrivacyChanged(MICROPHONE, micState);
                setGlobalRestriction(MICROPHONE, micState);
            }
            if (prevCamState != camState) {
            if (from == USER_NULL || prevCamState != camState) {
                mHandler.onUserGlobalSensorPrivacyChanged(CAMERA, camState);
                setGlobalRestriction(CAMERA, micState);
                setGlobalRestriction(CAMERA, camState);
            }
        }

+46 −18
Original line number Diff line number Diff line
@@ -125,6 +125,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
    private static final int MSG_IGNORE_PROXIMITY = 8;
    private static final int MSG_STOP = 9;
    private static final int MSG_UPDATE_BRIGHTNESS = 10;
    private static final int MSG_UPDATE_RBC = 11;

    private static final int PROXIMITY_UNKNOWN = -1;
    private static final int PROXIMITY_NEGATIVE = 0;
@@ -422,13 +423,13 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
    // PowerManager.BRIGHTNESS_INVALID_FLOAT when there's no temporary adjustment set.
    private float mTemporaryAutoBrightnessAdjustment;

    // Whether a reduce bright colors (rbc) change has been initiated by the user. We want to
    // retain the current backlight level when rbc is toggled, since rbc additionally makes the
    // screen appear dimmer using screen colors rather than backlight levels, and therefore we
    // don't actually want to compensate for this by then in/decreasing the backlight when
    // toggling this feature.
    // Whether reduce bright colors (rbc) has been turned on, or a change in strength has been
    // requested. We want to retain the current backlight level when rbc is toggled, since rbc
    // additionally makes the screen appear dimmer using screen colors rather than backlight levels,
    // and therefore we don't actually want to compensate for this by then in/decreasing the
    // backlight when toggling this feature.
    // This should be false during system start up.
    private boolean mPendingUserRbcChange;
    private boolean mPendingRbcOnOrChanged = false;

    // Animators.
    private ObjectAnimator mColorFadeOnAnimator;
@@ -564,23 +565,35 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
                @Override
                public void onReduceBrightColorsActivationChanged(boolean activated,
                        boolean userInitiated) {
                    applyReduceBrightColorsSplineAdjustment(userInitiated);
                    applyReduceBrightColorsSplineAdjustment(
                            /* rbcStrengthChanged= */ false, activated);

                }

                @Override
                public void onReduceBrightColorsStrengthChanged(int strength) {
                    applyReduceBrightColorsSplineAdjustment(/*userInitiated*/ false);
                    applyReduceBrightColorsSplineAdjustment(
                            /* rbcStrengthChanged= */ true, /* justActivated= */ false);
                }
            });
            if (active) {
                applyReduceBrightColorsSplineAdjustment(/*userInitiated*/ false);
                applyReduceBrightColorsSplineAdjustment(
                        /* rbcStrengthChanged= */ false,  /* justActivated= */ false);
            }
        } else {
            mCdsi = null;
        }
    }

    private void applyReduceBrightColorsSplineAdjustment(boolean userInitiated) {
    private void applyReduceBrightColorsSplineAdjustment(
            boolean rbcStrengthChanged, boolean justActivated) {
        final int strengthChanged = rbcStrengthChanged ? 1 : 0;
        final int activated = justActivated ? 1 : 0;
        mHandler.obtainMessage(MSG_UPDATE_RBC, strengthChanged, activated).sendToTarget();
        sendUpdatePowerState();
    }

    private void handleRbcChanged(boolean strengthChanged, boolean justActivated) {
        if (mBrightnessMapper == null) {
            Log.w(TAG, "No brightness mapping available to recalculate splines");
            return;
@@ -591,8 +604,13 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
            adjustedNits[i] = mCdsi.getReduceBrightColorsAdjustedBrightnessNits(mNitsRange[i]);
        }
        mBrightnessMapper.recalculateSplines(mCdsi.isReduceBrightColorsActivated(), adjustedNits);
        mPendingUserRbcChange = userInitiated;
        sendUpdatePowerState();

        mPendingRbcOnOrChanged = strengthChanged || justActivated;

        // Reset model if strength changed OR rbc is turned off
        if (strengthChanged || !justActivated && mAutomaticBrightnessController != null) {
            mAutomaticBrightnessController.resetShortTermModel();
        }
    }

    /**
@@ -926,7 +944,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call

    private void reloadReduceBrightColours() {
        if (mCdsi != null && mCdsi.isReduceBrightColorsActivated()) {
            applyReduceBrightColorsSplineAdjustment(/*userInitiated*/ false);
            applyReduceBrightColorsSplineAdjustment(
                    /* rbcStrengthChanged= */ false, /* justActivated= */ false);
        }
    }

@@ -2072,21 +2091,24 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        return true;
    }

    // We want to return true if the user has set the screen brightness.
    // If they have just turned RBC on (and therefore added that interaction to the curve),
    // or changed the brightness another way, then we should return true.
    private boolean updateUserSetScreenBrightness() {
        final boolean brightnessSplineChanged = mPendingUserRbcChange;
        if (mPendingUserRbcChange && !Float.isNaN(mCurrentScreenBrightnessSetting)) {
        final boolean treatAsIfUserChanged = mPendingRbcOnOrChanged;
        if (treatAsIfUserChanged && !Float.isNaN(mCurrentScreenBrightnessSetting)) {
            mLastUserSetScreenBrightness = mCurrentScreenBrightnessSetting;
        }
        mPendingUserRbcChange = false;
        mPendingRbcOnOrChanged = false;

        if ((Float.isNaN(mPendingScreenBrightnessSetting)
                || mPendingScreenBrightnessSetting < 0.0f)) {
            return brightnessSplineChanged;
            return treatAsIfUserChanged;
        }
        if (mCurrentScreenBrightnessSetting == mPendingScreenBrightnessSetting) {
            mPendingScreenBrightnessSetting = PowerManager.BRIGHTNESS_INVALID_FLOAT;
            mTemporaryScreenBrightness = PowerManager.BRIGHTNESS_INVALID_FLOAT;
            return brightnessSplineChanged;
            return treatAsIfUserChanged;
        }
        setCurrentScreenBrightness(mPendingScreenBrightnessSetting);
        mLastUserSetScreenBrightness = mPendingScreenBrightnessSetting;
@@ -2428,6 +2450,12 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
                    }
                    handleSettingsChange(false /*userSwitch*/);
                    break;

                case MSG_UPDATE_RBC:
                    final int strengthChanged = msg.arg1;
                    final int justActivated = msg.arg2;
                    handleRbcChanged(strengthChanged == 1, justActivated == 1);
                    break;
            }
        }
    }
+13 −5
Original line number Diff line number Diff line
@@ -209,6 +209,12 @@ public class ContextHubClientBroker extends IContextHubClient.Stub
     */
    private AtomicBoolean mIsPendingIntentCancelled = new AtomicBoolean(false);

    /**
     * True if a permissions query has been issued and is being processed. Used to prevent too many
     * queries from being issued by a single client at once.
     */
    private AtomicBoolean mIsPermQueryIssued = new AtomicBoolean(false);

    /*
     * True if the application creating the client has the ACCESS_CONTEXT_HUB permission.
     */
@@ -240,11 +246,11 @@ public class ContextHubClientBroker extends IContextHubClient.Stub
    private final IContextHubTransactionCallback mQueryPermsCallback =
            new IContextHubTransactionCallback.Stub() {
            @Override
            public void onTransactionComplete(int result) {
            }
            public void onTransactionComplete(int result) {}

            @Override
            public void onQueryResponse(int result, List<NanoAppState> nanoAppStateList) {
                mIsPermQueryIssued.set(false);
                if (result != ContextHubTransaction.RESULT_SUCCESS && nanoAppStateList != null) {
                    Log.e(TAG, "Permissions query failed, but still received nanoapp state");
                } else if (nanoAppStateList != null) {
@@ -656,10 +662,12 @@ public class ContextHubClientBroker extends IContextHubClient.Stub
     * communicated with in the past.
     */
    private void checkNanoappPermsAsync() {
        if (!mIsPermQueryIssued.getAndSet(true)) {
            ContextHubServiceTransaction transaction = mTransactionManager.createQueryTransaction(
                    mAttachedContextHubInfo.getId(), mQueryPermsCallback, mPackage);
            mTransactionManager.addTransaction(transaction);
        }
    }

    private int updateNanoAppAuthState(
            long nanoAppId, List<String> nanoappPermissions, boolean gracePeriodExpired) {
+8 −5
Original line number Diff line number Diff line
@@ -557,11 +557,14 @@ final class DefaultPermissionGrantPolicy {
        grantPermissionsToSystemPackage(pm, verifier, userId, PHONE_PERMISSIONS, SMS_PERMISSIONS);

        // SetupWizard
        grantPermissionsToSystemPackage(pm,
                ArrayUtils.firstOrNull(getKnownPackages(
                        PackageManagerInternal.PACKAGE_SETUP_WIZARD, userId)), userId,
                PHONE_PERMISSIONS, CONTACTS_PERMISSIONS, ALWAYS_LOCATION_PERMISSIONS,
                CAMERA_PERMISSIONS);
        final String setupWizardPackage = ArrayUtils.firstOrNull(getKnownPackages(
                PackageManagerInternal.PACKAGE_SETUP_WIZARD, userId));
        grantPermissionsToSystemPackage(pm, setupWizardPackage, userId, PHONE_PERMISSIONS,
                CONTACTS_PERMISSIONS, ALWAYS_LOCATION_PERMISSIONS, CAMERA_PERMISSIONS);
        if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE, 0)) {
            grantPermissionsToSystemPackage(
                    pm, setupWizardPackage, userId, NEARBY_DEVICES_PERMISSIONS);
        }

        // Camera
        grantPermissionsToSystemPackage(pm,
Loading