Loading services/core/java/com/android/server/hdmi/DeviceDiscoveryAction.java +1 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ import java.util.List; * <li>Gather "Vendor id" of all acknowledge devices * </ol> */ final class DeviceDiscoveryAction extends FeatureAction { final class DeviceDiscoveryAction extends HdmiCecFeatureAction { private static final String TAG = "DeviceDiscoveryAction"; // State in which the action is waiting for device polling. Loading services/core/java/com/android/server/hdmi/DevicePowerStatusAction.java +1 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ import android.util.Slog; * <p> * Package-private, accessed by {@link HdmiControlService} only. */ final class DevicePowerStatusAction extends FeatureAction { final class DevicePowerStatusAction extends HdmiCecFeatureAction { private static final String TAG = "DevicePowerStatusAction"; // State in which the action is waiting for <Report Power Status>. Loading services/core/java/com/android/server/hdmi/DeviceSelectAction.java +1 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ import com.android.server.hdmi.HdmiControlService.SendMessageCallback; * for a new active source. It does its best to wake up the target in standby mode * before issuing the command >Set Stream path<. */ final class DeviceSelectAction extends FeatureAction { final class DeviceSelectAction extends HdmiCecFeatureAction { private static final String TAG = "DeviceSelect"; // Time in milliseconds we wait for the device power status to switch to 'Standby' Loading services/core/java/com/android/server/hdmi/FeatureAction.java→services/core/java/com/android/server/hdmi/HdmiCecFeatureAction.java +22 −24 Original line number Diff line number Diff line Loading @@ -29,21 +29,19 @@ import java.util.List; /** * Encapsulates a sequence of CEC/MHL command exchange for a certain feature. * * <p>Many CEC/MHL features are accomplished by CEC devices on the bus exchanging * more than one command. {@link FeatureAction} represents the life cycle of the communication, * manages the state as the process progresses, and if necessary, returns the result * to the caller which initiates the action, through the callback given at the creation * of the object. All the actual action classes inherit FeatureAction. * * <p>More than one FeatureAction objects can be up and running simultaneously, * maintained by {@link HdmiCecLocalDevice}. Each action is passed a new command * arriving from the bus, and either consumes it if the command is what the action expects, * or yields it to other action. * * Declared as package private, accessed by {@link HdmiControlService} only. * <p> * Many CEC/MHL features are accomplished by CEC devices on the bus exchanging more than one * command. {@link HdmiCecFeatureAction} represents the life cycle of the communication, manages the * state as the process progresses, and if necessary, returns the result to the caller which * initiates the action, through the callback given at the creation of the object. All the actual * action classes inherit FeatureAction. * <p> * More than one FeatureAction objects can be up and running simultaneously, maintained by * {@link HdmiCecLocalDevice}. Each action is passed a new command arriving from the bus, and either * consumes it if the command is what the action expects, or yields it to other action. Declared as * package private, accessed by {@link HdmiControlService} only. */ abstract class FeatureAction { abstract class HdmiCecFeatureAction { private static final String TAG = "FeatureAction"; // Timer handler message used for timeout event Loading @@ -61,9 +59,9 @@ abstract class FeatureAction { // Timer that manages timeout events. protected ActionTimer mActionTimer; private ArrayList<Pair<FeatureAction, Runnable>> mOnFinishedCallbacks; private ArrayList<Pair<HdmiCecFeatureAction, Runnable>> mOnFinishedCallbacks; FeatureAction(HdmiCecLocalDevice source) { HdmiCecFeatureAction(HdmiCecLocalDevice source) { mSource = source; mService = mSource.getService(); mActionTimer = createActionTimer(mService.getServiceLooper()); Loading Loading @@ -173,11 +171,11 @@ abstract class FeatureAction { mService.sendCecCommand(cmd, callback); } protected final void addAndStartAction(FeatureAction action) { protected final void addAndStartAction(HdmiCecFeatureAction action) { mSource.addAndStartAction(action); } protected final <T extends FeatureAction> List<T> getActions(final Class<T> clazz) { protected final <T extends HdmiCecFeatureAction> List<T> getActions(final Class<T> clazz) { return mSource.getActions(clazz); } Loading @@ -191,16 +189,16 @@ abstract class FeatureAction { * * @param action */ protected final void removeAction(FeatureAction action) { protected final void removeAction(HdmiCecFeatureAction action) { mSource.removeAction(action); } protected final <T extends FeatureAction> void removeAction(final Class<T> clazz) { protected final <T extends HdmiCecFeatureAction> void removeAction(final Class<T> clazz) { mSource.removeActionExcept(clazz, null); } protected final <T extends FeatureAction> void removeActionExcept(final Class<T> clazz, final FeatureAction exception) { protected final <T extends HdmiCecFeatureAction> void removeActionExcept(final Class<T> clazz, final HdmiCecFeatureAction exception) { mSource.removeActionExcept(clazz, exception); } Loading Loading @@ -233,7 +231,7 @@ abstract class FeatureAction { removeAction(this); } if (mOnFinishedCallbacks != null) { for (Pair<FeatureAction, Runnable> actionCallbackPair: mOnFinishedCallbacks) { for (Pair<HdmiCecFeatureAction, Runnable> actionCallbackPair: mOnFinishedCallbacks) { if (actionCallbackPair.first.mState != STATE_NONE) { actionCallbackPair.second.run(); } Loading Loading @@ -269,7 +267,7 @@ abstract class FeatureAction { getSourceAddress(), targetAddress)); } protected final void addOnFinishedCallback(FeatureAction action, Runnable runnable) { protected final void addOnFinishedCallback(HdmiCecFeatureAction action, Runnable runnable) { if (mOnFinishedCallbacks == null) { mOnFinishedCallbacks = new ArrayList<>(); } Loading services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java +17 −17 Original line number Diff line number Diff line Loading @@ -102,7 +102,7 @@ abstract class HdmiCecLocalDevice { // A collection of FeatureAction. // Note that access to this collection should happen in service thread. private final LinkedList<FeatureAction> mActions = new LinkedList<>(); private final LinkedList<HdmiCecFeatureAction> mActions = new LinkedList<>(); private final Handler mHandler = new Handler () { @Override Loading Loading @@ -250,7 +250,7 @@ abstract class HdmiCecLocalDevice { @ServiceThreadOnly private boolean dispatchMessageToAction(HdmiCecMessage message) { assertRunOnServiceThread(); for (FeatureAction action : mActions) { for (HdmiCecFeatureAction action : mActions) { if (action.processCommand(message)) { return true; } Loading Loading @@ -486,7 +486,7 @@ abstract class HdmiCecLocalDevice { } @ServiceThreadOnly void addAndStartAction(final FeatureAction action) { void addAndStartAction(final HdmiCecFeatureAction action) { assertRunOnServiceThread(); if (mService.isPowerStandbyOrTransient()) { Slog.w(TAG, "Skip the action during Standby: " + action); Loading @@ -498,9 +498,9 @@ abstract class HdmiCecLocalDevice { // See if we have an action of a given type in progress. @ServiceThreadOnly <T extends FeatureAction> boolean hasAction(final Class<T> clazz) { <T extends HdmiCecFeatureAction> boolean hasAction(final Class<T> clazz) { assertRunOnServiceThread(); for (FeatureAction action : mActions) { for (HdmiCecFeatureAction action : mActions) { if (action.getClass().equals(clazz)) { return true; } Loading @@ -510,10 +510,10 @@ abstract class HdmiCecLocalDevice { // Returns all actions matched with given class type. @ServiceThreadOnly <T extends FeatureAction> List<T> getActions(final Class<T> clazz) { <T extends HdmiCecFeatureAction> List<T> getActions(final Class<T> clazz) { assertRunOnServiceThread(); List<T> actions = Collections.<T>emptyList(); for (FeatureAction action : mActions) { for (HdmiCecFeatureAction action : mActions) { if (action.getClass().equals(clazz)) { if (actions.isEmpty()) { actions = new ArrayList<T>(); Loading @@ -525,12 +525,12 @@ abstract class HdmiCecLocalDevice { } /** * Remove the given {@link FeatureAction} object from the action queue. * Remove the given {@link HdmiCecFeatureAction} object from the action queue. * * @param action {@link FeatureAction} to remove * @param action {@link HdmiCecFeatureAction} to remove */ @ServiceThreadOnly void removeAction(final FeatureAction action) { void removeAction(final HdmiCecFeatureAction action) { assertRunOnServiceThread(); action.finish(false); mActions.remove(action); Loading @@ -539,19 +539,19 @@ abstract class HdmiCecLocalDevice { // Remove all actions matched with the given Class type. @ServiceThreadOnly <T extends FeatureAction> void removeAction(final Class<T> clazz) { <T extends HdmiCecFeatureAction> void removeAction(final Class<T> clazz) { assertRunOnServiceThread(); removeActionExcept(clazz, null); } // Remove all actions matched with the given Class type besides |exception|. @ServiceThreadOnly <T extends FeatureAction> void removeActionExcept(final Class<T> clazz, final FeatureAction exception) { <T extends HdmiCecFeatureAction> void removeActionExcept(final Class<T> clazz, final HdmiCecFeatureAction exception) { assertRunOnServiceThread(); Iterator<FeatureAction> iter = mActions.iterator(); Iterator<HdmiCecFeatureAction> iter = mActions.iterator(); while (iter.hasNext()) { FeatureAction action = iter.next(); HdmiCecFeatureAction action = iter.next(); if (action != exception && action.getClass().equals(clazz)) { action.finish(false); iter.remove(); Loading Loading @@ -698,9 +698,9 @@ abstract class HdmiCecLocalDevice { // If all actions are not cleared in DEVICE_CLEANUP_TIMEOUT, enforce to finish them. // onCleard will be called at the last action's finish method. Iterator<FeatureAction> iter = mActions.iterator(); Iterator<HdmiCecFeatureAction> iter = mActions.iterator(); while (iter.hasNext()) { FeatureAction action = iter.next(); HdmiCecFeatureAction action = iter.next(); action.finish(false); iter.remove(); } Loading Loading
services/core/java/com/android/server/hdmi/DeviceDiscoveryAction.java +1 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ import java.util.List; * <li>Gather "Vendor id" of all acknowledge devices * </ol> */ final class DeviceDiscoveryAction extends FeatureAction { final class DeviceDiscoveryAction extends HdmiCecFeatureAction { private static final String TAG = "DeviceDiscoveryAction"; // State in which the action is waiting for device polling. Loading
services/core/java/com/android/server/hdmi/DevicePowerStatusAction.java +1 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ import android.util.Slog; * <p> * Package-private, accessed by {@link HdmiControlService} only. */ final class DevicePowerStatusAction extends FeatureAction { final class DevicePowerStatusAction extends HdmiCecFeatureAction { private static final String TAG = "DevicePowerStatusAction"; // State in which the action is waiting for <Report Power Status>. Loading
services/core/java/com/android/server/hdmi/DeviceSelectAction.java +1 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ import com.android.server.hdmi.HdmiControlService.SendMessageCallback; * for a new active source. It does its best to wake up the target in standby mode * before issuing the command >Set Stream path<. */ final class DeviceSelectAction extends FeatureAction { final class DeviceSelectAction extends HdmiCecFeatureAction { private static final String TAG = "DeviceSelect"; // Time in milliseconds we wait for the device power status to switch to 'Standby' Loading
services/core/java/com/android/server/hdmi/FeatureAction.java→services/core/java/com/android/server/hdmi/HdmiCecFeatureAction.java +22 −24 Original line number Diff line number Diff line Loading @@ -29,21 +29,19 @@ import java.util.List; /** * Encapsulates a sequence of CEC/MHL command exchange for a certain feature. * * <p>Many CEC/MHL features are accomplished by CEC devices on the bus exchanging * more than one command. {@link FeatureAction} represents the life cycle of the communication, * manages the state as the process progresses, and if necessary, returns the result * to the caller which initiates the action, through the callback given at the creation * of the object. All the actual action classes inherit FeatureAction. * * <p>More than one FeatureAction objects can be up and running simultaneously, * maintained by {@link HdmiCecLocalDevice}. Each action is passed a new command * arriving from the bus, and either consumes it if the command is what the action expects, * or yields it to other action. * * Declared as package private, accessed by {@link HdmiControlService} only. * <p> * Many CEC/MHL features are accomplished by CEC devices on the bus exchanging more than one * command. {@link HdmiCecFeatureAction} represents the life cycle of the communication, manages the * state as the process progresses, and if necessary, returns the result to the caller which * initiates the action, through the callback given at the creation of the object. All the actual * action classes inherit FeatureAction. * <p> * More than one FeatureAction objects can be up and running simultaneously, maintained by * {@link HdmiCecLocalDevice}. Each action is passed a new command arriving from the bus, and either * consumes it if the command is what the action expects, or yields it to other action. Declared as * package private, accessed by {@link HdmiControlService} only. */ abstract class FeatureAction { abstract class HdmiCecFeatureAction { private static final String TAG = "FeatureAction"; // Timer handler message used for timeout event Loading @@ -61,9 +59,9 @@ abstract class FeatureAction { // Timer that manages timeout events. protected ActionTimer mActionTimer; private ArrayList<Pair<FeatureAction, Runnable>> mOnFinishedCallbacks; private ArrayList<Pair<HdmiCecFeatureAction, Runnable>> mOnFinishedCallbacks; FeatureAction(HdmiCecLocalDevice source) { HdmiCecFeatureAction(HdmiCecLocalDevice source) { mSource = source; mService = mSource.getService(); mActionTimer = createActionTimer(mService.getServiceLooper()); Loading Loading @@ -173,11 +171,11 @@ abstract class FeatureAction { mService.sendCecCommand(cmd, callback); } protected final void addAndStartAction(FeatureAction action) { protected final void addAndStartAction(HdmiCecFeatureAction action) { mSource.addAndStartAction(action); } protected final <T extends FeatureAction> List<T> getActions(final Class<T> clazz) { protected final <T extends HdmiCecFeatureAction> List<T> getActions(final Class<T> clazz) { return mSource.getActions(clazz); } Loading @@ -191,16 +189,16 @@ abstract class FeatureAction { * * @param action */ protected final void removeAction(FeatureAction action) { protected final void removeAction(HdmiCecFeatureAction action) { mSource.removeAction(action); } protected final <T extends FeatureAction> void removeAction(final Class<T> clazz) { protected final <T extends HdmiCecFeatureAction> void removeAction(final Class<T> clazz) { mSource.removeActionExcept(clazz, null); } protected final <T extends FeatureAction> void removeActionExcept(final Class<T> clazz, final FeatureAction exception) { protected final <T extends HdmiCecFeatureAction> void removeActionExcept(final Class<T> clazz, final HdmiCecFeatureAction exception) { mSource.removeActionExcept(clazz, exception); } Loading Loading @@ -233,7 +231,7 @@ abstract class FeatureAction { removeAction(this); } if (mOnFinishedCallbacks != null) { for (Pair<FeatureAction, Runnable> actionCallbackPair: mOnFinishedCallbacks) { for (Pair<HdmiCecFeatureAction, Runnable> actionCallbackPair: mOnFinishedCallbacks) { if (actionCallbackPair.first.mState != STATE_NONE) { actionCallbackPair.second.run(); } Loading Loading @@ -269,7 +267,7 @@ abstract class FeatureAction { getSourceAddress(), targetAddress)); } protected final void addOnFinishedCallback(FeatureAction action, Runnable runnable) { protected final void addOnFinishedCallback(HdmiCecFeatureAction action, Runnable runnable) { if (mOnFinishedCallbacks == null) { mOnFinishedCallbacks = new ArrayList<>(); } Loading
services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java +17 −17 Original line number Diff line number Diff line Loading @@ -102,7 +102,7 @@ abstract class HdmiCecLocalDevice { // A collection of FeatureAction. // Note that access to this collection should happen in service thread. private final LinkedList<FeatureAction> mActions = new LinkedList<>(); private final LinkedList<HdmiCecFeatureAction> mActions = new LinkedList<>(); private final Handler mHandler = new Handler () { @Override Loading Loading @@ -250,7 +250,7 @@ abstract class HdmiCecLocalDevice { @ServiceThreadOnly private boolean dispatchMessageToAction(HdmiCecMessage message) { assertRunOnServiceThread(); for (FeatureAction action : mActions) { for (HdmiCecFeatureAction action : mActions) { if (action.processCommand(message)) { return true; } Loading Loading @@ -486,7 +486,7 @@ abstract class HdmiCecLocalDevice { } @ServiceThreadOnly void addAndStartAction(final FeatureAction action) { void addAndStartAction(final HdmiCecFeatureAction action) { assertRunOnServiceThread(); if (mService.isPowerStandbyOrTransient()) { Slog.w(TAG, "Skip the action during Standby: " + action); Loading @@ -498,9 +498,9 @@ abstract class HdmiCecLocalDevice { // See if we have an action of a given type in progress. @ServiceThreadOnly <T extends FeatureAction> boolean hasAction(final Class<T> clazz) { <T extends HdmiCecFeatureAction> boolean hasAction(final Class<T> clazz) { assertRunOnServiceThread(); for (FeatureAction action : mActions) { for (HdmiCecFeatureAction action : mActions) { if (action.getClass().equals(clazz)) { return true; } Loading @@ -510,10 +510,10 @@ abstract class HdmiCecLocalDevice { // Returns all actions matched with given class type. @ServiceThreadOnly <T extends FeatureAction> List<T> getActions(final Class<T> clazz) { <T extends HdmiCecFeatureAction> List<T> getActions(final Class<T> clazz) { assertRunOnServiceThread(); List<T> actions = Collections.<T>emptyList(); for (FeatureAction action : mActions) { for (HdmiCecFeatureAction action : mActions) { if (action.getClass().equals(clazz)) { if (actions.isEmpty()) { actions = new ArrayList<T>(); Loading @@ -525,12 +525,12 @@ abstract class HdmiCecLocalDevice { } /** * Remove the given {@link FeatureAction} object from the action queue. * Remove the given {@link HdmiCecFeatureAction} object from the action queue. * * @param action {@link FeatureAction} to remove * @param action {@link HdmiCecFeatureAction} to remove */ @ServiceThreadOnly void removeAction(final FeatureAction action) { void removeAction(final HdmiCecFeatureAction action) { assertRunOnServiceThread(); action.finish(false); mActions.remove(action); Loading @@ -539,19 +539,19 @@ abstract class HdmiCecLocalDevice { // Remove all actions matched with the given Class type. @ServiceThreadOnly <T extends FeatureAction> void removeAction(final Class<T> clazz) { <T extends HdmiCecFeatureAction> void removeAction(final Class<T> clazz) { assertRunOnServiceThread(); removeActionExcept(clazz, null); } // Remove all actions matched with the given Class type besides |exception|. @ServiceThreadOnly <T extends FeatureAction> void removeActionExcept(final Class<T> clazz, final FeatureAction exception) { <T extends HdmiCecFeatureAction> void removeActionExcept(final Class<T> clazz, final HdmiCecFeatureAction exception) { assertRunOnServiceThread(); Iterator<FeatureAction> iter = mActions.iterator(); Iterator<HdmiCecFeatureAction> iter = mActions.iterator(); while (iter.hasNext()) { FeatureAction action = iter.next(); HdmiCecFeatureAction action = iter.next(); if (action != exception && action.getClass().equals(clazz)) { action.finish(false); iter.remove(); Loading Loading @@ -698,9 +698,9 @@ abstract class HdmiCecLocalDevice { // If all actions are not cleared in DEVICE_CLEANUP_TIMEOUT, enforce to finish them. // onCleard will be called at the last action's finish method. Iterator<FeatureAction> iter = mActions.iterator(); Iterator<HdmiCecFeatureAction> iter = mActions.iterator(); while (iter.hasNext()) { FeatureAction action = iter.next(); HdmiCecFeatureAction action = iter.next(); action.finish(false); iter.remove(); } Loading