Loading services/core/java/com/android/server/hdmi/HdmiCecFeatureAction.java +7 −2 Original line number Diff line number Diff line Loading @@ -73,8 +73,9 @@ abstract class HdmiCecFeatureAction { } /** * Called right after the action is created. Initialization or first step to take * for the action can be done in this method. * Called after the action is created. Initialization or first step to take * for the action can be done in this method. Shall update {@code mState} to * indicate that the action has started. * * @return true if the operation is successful; otherwise false. */ Loading Loading @@ -162,6 +163,10 @@ abstract class HdmiCecFeatureAction { mActionTimer.sendTimerMessage(state, delayMillis); } boolean started() { return mState != STATE_NONE; } protected final void sendCommand(HdmiCecMessage cmd) { mService.sendCecCommand(cmd); } Loading services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java +13 −2 Original line number Diff line number Diff line Loading @@ -617,14 +617,25 @@ abstract class HdmiCecLocalDevice { @ServiceThreadOnly void addAndStartAction(final HdmiCecFeatureAction action) { assertRunOnServiceThread(); mActions.add(action); if (mService.isPowerStandbyOrTransient()) { Slog.w(TAG, "Skip the action during Standby: " + action); Slog.i(TAG, "Not ready to start action. Queued for deferred start:" + action); return; } mActions.add(action); action.start(); } @ServiceThreadOnly void startQueuedActions() { assertRunOnServiceThread(); for (HdmiCecFeatureAction action : mActions) { if (!action.started()) { Slog.i(TAG, "Starting queued action:" + action); action.start(); } } } // See if we have an action of a given type in progress. @ServiceThreadOnly <T extends HdmiCecFeatureAction> boolean hasAction(final Class<T> clazz) { Loading services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java +7 −0 Original line number Diff line number Diff line Loading @@ -38,12 +38,19 @@ final class HdmiCecLocalDevicePlayback extends HdmiCecLocalDevice { super(service, HdmiDeviceInfo.DEVICE_PLAYBACK); } @Override void init() { super.init(); mIsActiveSource = false; } @Override @ServiceThreadOnly protected void onAddressAllocated(int logicalAddress, int reason) { assertRunOnServiceThread(); mService.sendCecCommand(HdmiCecMessageBuilder.buildReportPhysicalAddressCommand( mAddress, mService.getPhysicalAddress(), mDeviceType)); startQueuedActions(); } @Override Loading services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java +1 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { launchRoutingControl(reason != HdmiControlService.INITIATED_BY_ENABLE_CEC && reason != HdmiControlService.INITIATED_BY_BOOT_UP); launchDeviceDiscovery(); startQueuedActions(); } @Override Loading services/core/java/com/android/server/hdmi/HdmiControlService.java +7 −2 Original line number Diff line number Diff line Loading @@ -415,12 +415,17 @@ public final class HdmiControlService extends SystemService { assertRunOnServiceThread(); // A container for [Device type, Local device info]. ArrayList<HdmiCecLocalDevice> localDevices = new ArrayList<>(); clearLocalDevices(); for (int type : mLocalDevices) { final HdmiCecLocalDevice localDevice = HdmiCecLocalDevice.create(this, type); HdmiCecLocalDevice localDevice = mCecController.getLocalDevice(type); if (localDevice == null) { localDevice = HdmiCecLocalDevice.create(this, type); } localDevice.init(); localDevices.add(localDevice); } // It's now safe to flush existing local devices from mCecController since they were // already moved to 'localDevices'. clearLocalDevices(); allocateLogicalAddress(localDevices, initiatedBy); } Loading Loading
services/core/java/com/android/server/hdmi/HdmiCecFeatureAction.java +7 −2 Original line number Diff line number Diff line Loading @@ -73,8 +73,9 @@ abstract class HdmiCecFeatureAction { } /** * Called right after the action is created. Initialization or first step to take * for the action can be done in this method. * Called after the action is created. Initialization or first step to take * for the action can be done in this method. Shall update {@code mState} to * indicate that the action has started. * * @return true if the operation is successful; otherwise false. */ Loading Loading @@ -162,6 +163,10 @@ abstract class HdmiCecFeatureAction { mActionTimer.sendTimerMessage(state, delayMillis); } boolean started() { return mState != STATE_NONE; } protected final void sendCommand(HdmiCecMessage cmd) { mService.sendCecCommand(cmd); } Loading
services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java +13 −2 Original line number Diff line number Diff line Loading @@ -617,14 +617,25 @@ abstract class HdmiCecLocalDevice { @ServiceThreadOnly void addAndStartAction(final HdmiCecFeatureAction action) { assertRunOnServiceThread(); mActions.add(action); if (mService.isPowerStandbyOrTransient()) { Slog.w(TAG, "Skip the action during Standby: " + action); Slog.i(TAG, "Not ready to start action. Queued for deferred start:" + action); return; } mActions.add(action); action.start(); } @ServiceThreadOnly void startQueuedActions() { assertRunOnServiceThread(); for (HdmiCecFeatureAction action : mActions) { if (!action.started()) { Slog.i(TAG, "Starting queued action:" + action); action.start(); } } } // See if we have an action of a given type in progress. @ServiceThreadOnly <T extends HdmiCecFeatureAction> boolean hasAction(final Class<T> clazz) { Loading
services/core/java/com/android/server/hdmi/HdmiCecLocalDevicePlayback.java +7 −0 Original line number Diff line number Diff line Loading @@ -38,12 +38,19 @@ final class HdmiCecLocalDevicePlayback extends HdmiCecLocalDevice { super(service, HdmiDeviceInfo.DEVICE_PLAYBACK); } @Override void init() { super.init(); mIsActiveSource = false; } @Override @ServiceThreadOnly protected void onAddressAllocated(int logicalAddress, int reason) { assertRunOnServiceThread(); mService.sendCecCommand(HdmiCecMessageBuilder.buildReportPhysicalAddressCommand( mAddress, mService.getPhysicalAddress(), mDeviceType)); startQueuedActions(); } @Override Loading
services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java +1 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { launchRoutingControl(reason != HdmiControlService.INITIATED_BY_ENABLE_CEC && reason != HdmiControlService.INITIATED_BY_BOOT_UP); launchDeviceDiscovery(); startQueuedActions(); } @Override Loading
services/core/java/com/android/server/hdmi/HdmiControlService.java +7 −2 Original line number Diff line number Diff line Loading @@ -415,12 +415,17 @@ public final class HdmiControlService extends SystemService { assertRunOnServiceThread(); // A container for [Device type, Local device info]. ArrayList<HdmiCecLocalDevice> localDevices = new ArrayList<>(); clearLocalDevices(); for (int type : mLocalDevices) { final HdmiCecLocalDevice localDevice = HdmiCecLocalDevice.create(this, type); HdmiCecLocalDevice localDevice = mCecController.getLocalDevice(type); if (localDevice == null) { localDevice = HdmiCecLocalDevice.create(this, type); } localDevice.init(); localDevices.add(localDevice); } // It's now safe to flush existing local devices from mCecController since they were // already moved to 'localDevices'. clearLocalDevices(); allocateLogicalAddress(localDevices, initiatedBy); } Loading