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

Commit 59c06c1d authored by Amy's avatar Amy
Browse files

Use SystemProperties set and getBoolean for Constants property

HdmiControlService.readBooleanSetting does not get the correct property
value.
Note that this issue is caused by https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/base/+/5836043

Test: manual
Bug: 120622161
Change-Id: I5f3aa974c76a7ab671ae5f2d9a0009a96179d3b6
parent 793f1a79
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -268,7 +268,7 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
        mTvSystemAudioModeSupport = false;
        // Record the last state of System Audio Control before going to standby
        synchronized (mLock) {
            mService.writeStringSetting(
            mService.writeStringSystemProperty(
                    Constants.PROPERTY_LAST_SYSTEM_AUDIO_CONTROL,
                    mSystemAudioActivated ? "true" : "false");
        }
@@ -330,7 +330,7 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
    @ServiceThreadOnly
    protected void setPreferredAddress(int addr) {
        assertRunOnServiceThread();
        mService.writeStringSetting(
        mService.writeStringSystemProperty(
                Constants.PROPERTY_PREFERRED_ADDRESS_AUDIO_SYSTEM, String.valueOf(addr));
    }

@@ -469,7 +469,7 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
    protected boolean handleRequestArcInitiate(HdmiCecMessage message) {
        assertRunOnServiceThread();
        removeAction(ArcInitiationActionFromAvr.class);
        if (!mService.readBooleanSetting(Constants.PROPERTY_ARC_SUPPORT, true)) {
        if (!mService.readBooleanSystemProperty(Constants.PROPERTY_ARC_SUPPORT, true)) {
            mService.maySendFeatureAbortCommand(message, Constants.ABORT_UNRECOGNIZED_OPCODE);
        } else if (!isDirectConnectToTv()) {
            HdmiLogger.debug("AVR device is not directly connected with TV");
@@ -829,7 +829,7 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
        boolean currentMuteStatus =
                mService.getAudioManager().isStreamMute(AudioManager.STREAM_MUSIC);
        if (currentMuteStatus == newSystemAudioMode) {
            if (mService.readBooleanSetting(
            if (mService.readBooleanSystemProperty(
                    Constants.PROPERTY_SYSTEM_AUDIO_MODE_MUTING_ENABLE, true)
                            || newSystemAudioMode) {
                mService.getAudioManager()
+1 −1
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ public class HdmiCecLocalDevicePlayback extends HdmiCecLocalDeviceSource {
    @ServiceThreadOnly
    protected void setPreferredAddress(int addr) {
        assertRunOnServiceThread();
        mService.writeStringSetting(Constants.PROPERTY_PREFERRED_ADDRESS_PLAYBACK,
        mService.writeStringSystemProperty(Constants.PROPERTY_PREFERRED_ADDRESS_PLAYBACK,
                String.valueOf(addr));
    }

+7 −3
Original line number Diff line number Diff line
@@ -657,9 +657,13 @@ public class HdmiControlService extends SystemService {
        Global.putInt(cr, key, toInt(value));
    }

    void writeStringSetting(String key, String value) {
        ContentResolver cr = getContext().getContentResolver();
        Global.putString(cr, key, value);
    void writeStringSystemProperty(String key, String value) {
        SystemProperties.set(key, value);
    }

    @VisibleForTesting
    boolean readBooleanSystemProperty(String key, boolean defVal) {
        return SystemProperties.getBoolean(key, defVal);
    }

    private void initializeCec(int initiatedBy) {
+2 −2
Original line number Diff line number Diff line
@@ -147,12 +147,12 @@ public class HdmiCecLocalDeviceAudioSystemTest {
                }

                @Override
                void writeStringSetting(String key, String value) {
                void writeStringSystemProperty(String key, String value) {
                    // do nothing
                }

                @Override
                boolean readBooleanSetting(String key, boolean defVal) {
                boolean readBooleanSystemProperty(String key, boolean defVal) {
                    switch (key) {
                        case Constants.PROPERTY_SYSTEM_AUDIO_MODE_MUTING_ENABLE:
                            return mMutingEnabled;