diff options
Diffstat (limited to 'services')
21 files changed, 300 insertions, 172 deletions
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java index b3337bb..e3e0228 100644 --- a/services/core/java/com/android/server/TelephonyRegistry.java +++ b/services/core/java/com/android/server/TelephonyRegistry.java @@ -212,11 +212,12 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { //defaultSubId comes before new defaultSubId update) we need to recall all //possible missed notify callback synchronized (mRecords) { - for (Record r : mRecords) { - if(r.subId == SubscriptionManager.DEFAULT_SUB_ID) { - checkPossibleMissNotify(r, newDefaultPhoneId); - } - } + for (Record r : mRecords) { + if(r.subId == SubscriptionManager.DEFAULT_SUB_ID) { + checkPossibleMissNotify(r, newDefaultPhoneId); + } + } + handleRemoveListLocked(); } mDefaultSubId = newDefaultSubId; mDefaultPhoneId = newDefaultPhoneId; @@ -1445,7 +1446,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { r.callback.onServiceStateChanged( new ServiceState(mServiceState[phoneId])); } catch (RemoteException ex) { - remove(r.binder); + mRemoveList.add(r.binder); } } @@ -1472,7 +1473,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { r.callback.onSignalStrengthChanged((gsmSignalStrength == 99 ? -1 : gsmSignalStrength)); } catch (RemoteException ex) { - remove(r.binder); + mRemoveList.add(r.binder); } } @@ -1484,7 +1485,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { } r.callback.onCellInfoChanged(mCellInfo.get(phoneId)); } catch (RemoteException ex) { - remove(r.binder); + mRemoveList.add(r.binder); } } @@ -1497,7 +1498,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { r.callback.onMessageWaitingIndicatorChanged( mMessageWaiting[phoneId]); } catch (RemoteException ex) { - remove(r.binder); + mRemoveList.add(r.binder); } } @@ -1510,7 +1511,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { r.callback.onCallForwardingIndicatorChanged( mCallForwarding[phoneId]); } catch (RemoteException ex) { - remove(r.binder); + mRemoveList.add(r.binder); } } @@ -1535,7 +1536,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub { r.callback.onDataConnectionStateChanged(mDataConnectionState[phoneId], mDataConnectionNetworkType[phoneId]); } catch (RemoteException ex) { - remove(r.binder); + mRemoveList.add(r.binder); } } } diff --git a/services/core/java/com/android/server/display/OverlayDisplayAdapter.java b/services/core/java/com/android/server/display/OverlayDisplayAdapter.java index 3b23b6a..f514531 100644 --- a/services/core/java/com/android/server/display/OverlayDisplayAdapter.java +++ b/services/core/java/com/android/server/display/OverlayDisplayAdapter.java @@ -248,6 +248,7 @@ final class OverlayDisplayAdapter extends DisplayAdapter { mInfo.width = mWidth; mInfo.height = mHeight; mInfo.refreshRate = mRefreshRate; + mInfo.supportedRefreshRates = new float[] { mRefreshRate }; mInfo.densityDpi = mDensityDpi; mInfo.xDpi = mDensityDpi; mInfo.yDpi = mDensityDpi; diff --git a/services/core/java/com/android/server/display/VirtualDisplayAdapter.java b/services/core/java/com/android/server/display/VirtualDisplayAdapter.java index c2b4478..0232bad 100644 --- a/services/core/java/com/android/server/display/VirtualDisplayAdapter.java +++ b/services/core/java/com/android/server/display/VirtualDisplayAdapter.java @@ -257,6 +257,7 @@ final class VirtualDisplayAdapter extends DisplayAdapter { mInfo.width = mWidth; mInfo.height = mHeight; mInfo.refreshRate = 60; + mInfo.supportedRefreshRates = new float[] { 60.0f }; mInfo.densityDpi = mDensityDpi; mInfo.xDpi = mDensityDpi; mInfo.yDpi = mDensityDpi; diff --git a/services/core/java/com/android/server/display/WifiDisplayAdapter.java b/services/core/java/com/android/server/display/WifiDisplayAdapter.java index a17d731..6b010d9 100644 --- a/services/core/java/com/android/server/display/WifiDisplayAdapter.java +++ b/services/core/java/com/android/server/display/WifiDisplayAdapter.java @@ -625,6 +625,7 @@ final class WifiDisplayAdapter extends DisplayAdapter { mInfo.width = mWidth; mInfo.height = mHeight; mInfo.refreshRate = mRefreshRate; + mInfo.supportedRefreshRates = new float[] { mRefreshRate }; mInfo.presentationDeadlineNanos = 1000000000L / (int) mRefreshRate; // 1 frame mInfo.flags = mFlags; mInfo.type = Display.TYPE_WIFI; diff --git a/services/core/java/com/android/server/hdmi/DevicePowerStatusAction.java b/services/core/java/com/android/server/hdmi/DevicePowerStatusAction.java index d965caa..3dd1522 100644 --- a/services/core/java/com/android/server/hdmi/DevicePowerStatusAction.java +++ b/services/core/java/com/android/server/hdmi/DevicePowerStatusAction.java @@ -70,7 +70,8 @@ final class DevicePowerStatusAction extends HdmiCecFeatureAction { @Override boolean processCommand(HdmiCecMessage cmd) { - if (mState != STATE_WAITING_FOR_REPORT_POWER_STATUS) { + if (mState != STATE_WAITING_FOR_REPORT_POWER_STATUS + || mTargetAddress != cmd.getSource()) { return false; } if (cmd.getOpcode() == Constants.MESSAGE_REPORT_POWER_STATUS) { diff --git a/services/core/java/com/android/server/hdmi/DeviceSelectAction.java b/services/core/java/com/android/server/hdmi/DeviceSelectAction.java index d155e84..5a1d896 100644 --- a/services/core/java/com/android/server/hdmi/DeviceSelectAction.java +++ b/services/core/java/com/android/server/hdmi/DeviceSelectAction.java @@ -95,7 +95,7 @@ final class DeviceSelectAction extends HdmiCecFeatureAction { sendCommand(mGivePowerStatus, new SendMessageCallback() { @Override public void onSendCompleted(int error) { - if (error == Constants.SEND_RESULT_NAK) { + if (error != Constants.SEND_RESULT_SUCCESS) { invokeCallback(HdmiControlManager.RESULT_COMMUNICATION_FAILED); finish(); return; @@ -168,6 +168,10 @@ final class DeviceSelectAction extends HdmiCecFeatureAction { } private void sendSetStreamPath() { + // Turn the active source invalidated, which remains so till <Active Source> comes from + // the selected device. + tv().getActiveSource().invalidate(); + tv().setActivePath(mTarget.getPhysicalAddress()); sendCommand(HdmiCecMessageBuilder.buildSetStreamPath( getSourceAddress(), mTarget.getPhysicalAddress())); invokeCallback(HdmiControlManager.RESULT_SUCCESS); diff --git a/services/core/java/com/android/server/hdmi/HdmiCecFeatureAction.java b/services/core/java/com/android/server/hdmi/HdmiCecFeatureAction.java index b2300a6..c47e0e9 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecFeatureAction.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecFeatureAction.java @@ -84,8 +84,7 @@ abstract class HdmiCecFeatureAction { * Process the command. Called whenever a new command arrives. * * @param cmd command to process - * @return true if the command was consumed in the process; Otherwise false, which - * indicates that the command shall be handled by other actions. + * @return true if the command was consumed in the process; Otherwise false. */ abstract boolean processCommand(HdmiCecMessage cmd); diff --git a/services/core/java/com/android/server/hdmi/HdmiCecKeycode.java b/services/core/java/com/android/server/hdmi/HdmiCecKeycode.java index 61c9424..2eca42b 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecKeycode.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecKeycode.java @@ -18,6 +18,10 @@ package com.android.server.hdmi; import android.view.KeyEvent; +import libcore.util.EmptyArray; + +import java.util.Arrays; + /** * Helper class to translate android keycode to hdmi cec keycode and vice versa. */ @@ -156,46 +160,60 @@ final class HdmiCecKeycode { /** * A mapping between Android and CEC keycode. + * <p> + * Normal implementation of this looks like * - * <p>Normal implementation of this looks like * <pre> - * new KeycodeEntry(KeyEvent.KEYCODE_DPAD_CENTER, CEC_KEYCODE_SELECT); + * new KeycodeEntry(KeyEvent.KEYCODE_DPAD_CENTER, CEC_KEYCODE_SELECT); * </pre> - * <p>However, some keys in CEC requires additional parameter. - * In order to use parameterized cec key, add unique android keycode (existing or custom) - * corresponding to a pair of cec keycode and and its param. + * <p> + * However, some keys in CEC requires additional parameter. In order to use parameterized cec + * key, add unique android keycode (existing or custom) corresponding to a pair of cec keycode + * and and its param. + * * <pre> - * new KeycodeEntry(CUSTOME_ANDORID_KEY_1, CEC_KEYCODE_SELECT_BROADCAST_TYPE, - * UI_BROADCAST_TOGGLE_ALL); - * new KeycodeEntry(CUSTOME_ANDORID_KEY_2, CEC_KEYCODE_SELECT_BROADCAST_TYPE, - * UI_BROADCAST_ANALOGUE); + * new KeycodeEntry(CUSTOME_ANDORID_KEY_1, CEC_KEYCODE_SELECT_BROADCAST_TYPE, + * UI_BROADCAST_TOGGLE_ALL); + * new KeycodeEntry(CUSTOME_ANDORID_KEY_2, CEC_KEYCODE_SELECT_BROADCAST_TYPE, + * UI_BROADCAST_ANALOGUE); * </pre> */ private static class KeycodeEntry { private final int mAndroidKeycode; - private final int mCecKeycode; private final boolean mIsRepeatable; + private final byte[] mCecKeycodeAndParams; - private KeycodeEntry(int androidKeycode, int cecKeycode, boolean isRepeatable) { + private KeycodeEntry(int androidKeycode, int cecKeycode, boolean isRepeatable, + byte[] cecParams) { mAndroidKeycode = androidKeycode; - mCecKeycode = cecKeycode; mIsRepeatable = isRepeatable; + mCecKeycodeAndParams = new byte[cecParams.length + 1]; + System.arraycopy(cecParams, 0, mCecKeycodeAndParams, 1, cecParams.length); + mCecKeycodeAndParams[0] = (byte) (cecKeycode & 0xFF); + } + + private KeycodeEntry(int androidKeycode, int cecKeycode, boolean isRepeatable) { + this(androidKeycode, cecKeycode, isRepeatable, EmptyArray.BYTE); + } + + private KeycodeEntry(int androidKeycode, int cecKeycode, byte[] cecParams) { + this(androidKeycode, cecKeycode, true, cecParams); } private KeycodeEntry(int androidKeycode, int cecKeycode) { - this(androidKeycode, cecKeycode, true); + this(androidKeycode, cecKeycode, true, EmptyArray.BYTE); } - private int toCecKeycodeIfMatched(int androidKeycode) { + private byte[] toCecKeycodeAndParamIfMatched(int androidKeycode) { if (mAndroidKeycode == androidKeycode) { - return mCecKeycode; + return mCecKeycodeAndParams; } else { - return UNSUPPORTED_KEYCODE; + return null; } } - private int toAndroidKeycodeIfMatched(int cecKeycode) { - if (cecKeycode == mCecKeycode) { + private int toAndroidKeycodeIfMatched(byte[] cecKeycodeAndParams) { + if (Arrays.equals(mCecKeycodeAndParams, cecKeycodeAndParams)) { return mAndroidKeycode; } else { return UNSUPPORTED_KEYCODE; @@ -211,6 +229,11 @@ final class HdmiCecKeycode { } } + private static byte[] intToSingleByteArray(int value) { + return new byte[] { + (byte) (value & 0xFF) }; + } + // Keycode entry container for all mappings. // Note that order of entry is the same as above cec keycode definition. private static final KeycodeEntry[] KEYCODE_ENTRIES = new KeycodeEntry[] { @@ -227,19 +250,25 @@ final class HdmiCecKeycode { new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_LEFT_UP), // No Android keycode defined for CEC_KEYCODE_LEFT_DOWN new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_LEFT_DOWN), - new KeycodeEntry(KeyEvent.KEYCODE_HOME, CEC_KEYCODE_ROOT_MENU, false), - new KeycodeEntry(KeyEvent.KEYCODE_SETTINGS, CEC_KEYCODE_SETUP_MENU, false), - new KeycodeEntry(KeyEvent.KEYCODE_MENU, CEC_KEYCODE_CONTENTS_MENU, false), + new KeycodeEntry(KeyEvent.KEYCODE_HOME, CEC_KEYCODE_ROOT_MENU), + new KeycodeEntry(KeyEvent.KEYCODE_SETTINGS, CEC_KEYCODE_SETUP_MENU), + new KeycodeEntry(KeyEvent.KEYCODE_TV_CONTENTS_MENU, CEC_KEYCODE_CONTENTS_MENU, false), // No Android keycode defined for CEC_KEYCODE_FAVORITE_MENU new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_FAVORITE_MENU), + // Note that both BACK and ESCAPE are mapped to EXIT of CEC keycode. + // This would be problematic when translates CEC keycode to Android keycode. + // In current implementation, we pick BACK as mapping of EXIT key. + // If you'd like to map CEC EXIT to Android EXIT key, change order of + // the following two definition. new KeycodeEntry(KeyEvent.KEYCODE_BACK, CEC_KEYCODE_EXIT), + new KeycodeEntry(KeyEvent.KEYCODE_ESCAPE, CEC_KEYCODE_EXIT), // RESERVED new KeycodeEntry(KeyEvent.KEYCODE_MEDIA_TOP_MENU, CEC_KEYCODE_MEDIA_TOP_MENU), - // No Android keycode defined for CEC_KEYCODE_MEDIA_CONTEXT_SENSITIVE_MENU - new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_MEDIA_CONTEXT_SENSITIVE_MENU), + new KeycodeEntry(KeyEvent.KEYCODE_TV_MEDIA_CONTEXT_MENU, + CEC_KEYCODE_MEDIA_CONTEXT_SENSITIVE_MENU), // RESERVED // No Android keycode defined for CEC_KEYCODE_NUMBER_ENTRY_MODE - new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_NUMBER_ENTRY_MODE), + new KeycodeEntry(KeyEvent.KEYCODE_TV_NUMBER_ENTRY, CEC_KEYCODE_NUMBER_ENTRY_MODE), new KeycodeEntry(KeyEvent.KEYCODE_11, CEC_KEYCODE_NUMBER_11), new KeycodeEntry(KeyEvent.KEYCODE_12, CEC_KEYCODE_NUMBER_12), new KeycodeEntry(KeyEvent.KEYCODE_0, CEC_KEYCODE_NUMBER_0_OR_NUMBER_10), @@ -276,7 +305,12 @@ final class HdmiCecKeycode { new KeycodeEntry(KeyEvent.KEYCODE_VOLUME_MUTE, CEC_KEYCODE_MUTE, false), new KeycodeEntry(KeyEvent.KEYCODE_MEDIA_PLAY, CEC_KEYCODE_PLAY), new KeycodeEntry(KeyEvent.KEYCODE_MEDIA_STOP, CEC_KEYCODE_STOP), + // Note that we map both MEDIA_PAUSE and MEDIA_PLAY_PAUSE to CEC PAUSE key. + // When it translates CEC PAUSE key, it picks Android MEDIA_PAUSE key as a mapping of + // it. If you'd like to choose MEDIA_PLAY_PAUSE, please change order of the following + // two lines. new KeycodeEntry(KeyEvent.KEYCODE_MEDIA_PAUSE, CEC_KEYCODE_PAUSE), + new KeycodeEntry(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE, CEC_KEYCODE_PAUSE), new KeycodeEntry(KeyEvent.KEYCODE_MEDIA_RECORD, CEC_KEYCODE_RECORD), new KeycodeEntry(KeyEvent.KEYCODE_MEDIA_REWIND, CEC_KEYCODE_REWIND), new KeycodeEntry(KeyEvent.KEYCODE_MEDIA_FAST_FORWARD, CEC_KEYCODE_FAST_FORWARD), @@ -291,48 +325,61 @@ final class HdmiCecKeycode { new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_RESERVED), // No Android keycode defined for CEC_KEYCODE_ANGLE new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_ANGLE), - // No Android keycode defined for CEC_KEYCODE_SUB_PICTURE - new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_SUB_PICTURE), + new KeycodeEntry(KeyEvent.KEYCODE_CAPTIONS, CEC_KEYCODE_SUB_PICTURE), // No Android keycode defined for CEC_KEYCODE_VIDEO_ON_DEMAND new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_VIDEO_ON_DEMAND), new KeycodeEntry(KeyEvent.KEYCODE_GUIDE, CEC_KEYCODE_ELECTRONIC_PROGRAM_GUIDE), - // No Android keycode defined for CEC_KEYCODE_TIMER_PROGRAMMING - new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_TIMER_PROGRAMMING), + new KeycodeEntry(KeyEvent.KEYCODE_TV_TIMER_PROGRAMMING, CEC_KEYCODE_TIMER_PROGRAMMING), // No Android keycode defined for CEC_KEYCODE_INITIAL_CONFIGURATION new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_INITIAL_CONFIGURATION), // No Android keycode defined for CEC_KEYCODE_SELECT_BROADCAST_TYPE new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_SELECT_BROADCAST_TYPE), + new KeycodeEntry(KeyEvent.KEYCODE_TV_TERRESTRIAL_ANALOG, + CEC_KEYCODE_SELECT_BROADCAST_TYPE, true, + intToSingleByteArray(UI_BROADCAST_ANALOGUE)), + new KeycodeEntry(KeyEvent.KEYCODE_TV_TERRESTRIAL_DIGITAL, + CEC_KEYCODE_SELECT_BROADCAST_TYPE, true, + intToSingleByteArray(UI_BROADCAST_DIGITAL_TERRESTRIAL)), + new KeycodeEntry(KeyEvent.KEYCODE_TV_SATELLITE_BS, + CEC_KEYCODE_SELECT_BROADCAST_TYPE, true, + intToSingleByteArray(UI_BROADCAST_DIGITAL_SATELLITE)), + new KeycodeEntry(KeyEvent.KEYCODE_TV_SATELLITE_CS, + CEC_KEYCODE_SELECT_BROADCAST_TYPE, true, + intToSingleByteArray(UI_BROADCAST_DIGITAL_COMMNICATIONS_SATELLITE)), + new KeycodeEntry(KeyEvent.KEYCODE_TV_NETWORK, + CEC_KEYCODE_SELECT_BROADCAST_TYPE, true, + intToSingleByteArray(UI_BROADCAST_TOGGLE_ANALOGUE_DIGITAL)), // No Android keycode defined for CEC_KEYCODE_SELECT_SOUND_PRESENTATION new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_SELECT_SOUND_PRESENTATION), // RESERVED // The following deterministic key definitions do not need key mapping // since they are supposed to be generated programmatically only. // No Android keycode defined for CEC_KEYCODE_PLAY_FUNCTION - new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_PLAY_FUNCTION), + new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_PLAY_FUNCTION, false), // No Android keycode defined for CEC_KEYCODE_PAUSE_PLAY_FUNCTION - new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_PAUSE_PLAY_FUNCTION), + new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_PAUSE_PLAY_FUNCTION, false), // No Android keycode defined for CEC_KEYCODE_RECORD_FUNCTION - new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_RECORD_FUNCTION), + new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_RECORD_FUNCTION, false), // No Android keycode defined for CEC_KEYCODE_PAUSE_RECORD_FUNCTION - new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_PAUSE_RECORD_FUNCTION), + new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_PAUSE_RECORD_FUNCTION, false), // No Android keycode defined for CEC_KEYCODE_STOP_FUNCTION - new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_STOP_FUNCTION), + new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_STOP_FUNCTION, false), // No Android keycode defined for CEC_KEYCODE_MUTE_FUNCTION new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_MUTE_FUNCTION, false), // No Android keycode defined for CEC_KEYCODE_RESTORE_VOLUME_FUNCTION new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_RESTORE_VOLUME_FUNCTION, false), // No Android keycode defined for CEC_KEYCODE_TUNE_FUNCTION - new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_TUNE_FUNCTION), + new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_TUNE_FUNCTION, false), // No Android keycode defined for CEC_KEYCODE_SELECT_MEDIA_FUNCTION - new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_SELECT_MEDIA_FUNCTION), + new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_SELECT_MEDIA_FUNCTION, false), // No Android keycode defined for CEC_KEYCODE_SELECT_AV_INPUT_FUNCTION - new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_SELECT_AV_INPUT_FUNCTION), + new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_SELECT_AV_INPUT_FUNCTION, false), // No Android keycode defined for CEC_KEYCODE_SELECT_AUDIO_INPUT_FUNCTION - new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_SELECT_AUDIO_INPUT_FUNCTION), + new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_SELECT_AUDIO_INPUT_FUNCTION, false), // No Android keycode defined for CEC_KEYCODE_POWER_TOGGLE_FUNCTION - new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_POWER_TOGGLE_FUNCTION), + new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_POWER_TOGGLE_FUNCTION, false), // No Android keycode defined for CEC_KEYCODE_POWER_OFF_FUNCTION - new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_POWER_OFF_FUNCTION), + new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_POWER_OFF_FUNCTION, false), // No Android keycode defined for CEC_KEYCODE_POWER_ON_FUNCTION new KeycodeEntry(UNSUPPORTED_KEYCODE, CEC_KEYCODE_POWER_ON_FUNCTION, false), // RESERVED @@ -347,31 +394,31 @@ final class HdmiCecKeycode { }; /** - * Translate Android keycode to Hdmi Cec keycode. + * Translate Android keycode to Hdmi Cec keycode and params. * * @param keycode Android keycode. For details, refer {@link KeyEvent} - * @return single byte CEC keycode if matched. + * @return byte array of CEC keycode and params if matched. Otherwise, return null. */ - static int androidKeyToCecKey(int keycode) { + static byte[] androidKeyToCecKey(int keycode) { for (int i = 0; i < KEYCODE_ENTRIES.length; ++i) { - int cecKeycode = KEYCODE_ENTRIES[i].toCecKeycodeIfMatched(keycode); - if (cecKeycode != UNSUPPORTED_KEYCODE) { - return cecKeycode; + byte[] cecKeycodeAndParams = KEYCODE_ENTRIES[i].toCecKeycodeAndParamIfMatched(keycode); + if (cecKeycodeAndParams != null) { + return cecKeycodeAndParams; } } - return UNSUPPORTED_KEYCODE; + return null; } /** - * Translate Hdmi CEC keycode to Android keycode. + * Translate Hdmi CEC keycode with params to Android keycode. * - * @param keycode CEC keycode - * @return cec keycode corresponding to the given android keycode. - * If finds no matched keycode, return {@link #UNSUPPORTED_KEYCODE} + * @param cecKeycodeAndParams CEC keycode and params + * @return cec keycode corresponding to the given android keycode. If finds no matched keycode, + * return {@link #UNSUPPORTED_KEYCODE} */ - static int cecKeyToAndroidKey(int keycode) { + static int cecKeycodeAndParamsToAndroidKey(byte[] cecKeycodeAndParams) { for (int i = 0; i < KEYCODE_ENTRIES.length; ++i) { - int androidKey = KEYCODE_ENTRIES[i].toAndroidKeycodeIfMatched(keycode); + int androidKey = KEYCODE_ENTRIES[i].toAndroidKeycodeIfMatched(cecKeycodeAndParams); if (androidKey != UNSUPPORTED_KEYCODE) { return androidKey; } @@ -399,7 +446,6 @@ final class HdmiCecKeycode { * Returns {@code true} if given Android keycode is supported, otherwise {@code false}. */ static boolean isSupportedKeycode(int androidKeycode) { - return HdmiCecKeycode.androidKeyToCecKey(androidKeycode) - != HdmiCecKeycode.UNSUPPORTED_KEYCODE; - } + return HdmiCecKeycode.androidKeyToCecKey(androidKeycode) != null; + } } diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java index 41ac589..2ba6cee 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java @@ -34,7 +34,6 @@ import com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; -import java.util.LinkedList; import java.util.List; /** @@ -125,7 +124,7 @@ abstract class HdmiCecLocalDevice { // A collection of FeatureAction. // Note that access to this collection should happen in service thread. - private final LinkedList<HdmiCecFeatureAction> mActions = new LinkedList<>(); + private final ArrayList<HdmiCecFeatureAction> mActions = new ArrayList<>(); private final Handler mHandler = new Handler () { @Override @@ -290,12 +289,14 @@ abstract class HdmiCecLocalDevice { @ServiceThreadOnly private boolean dispatchMessageToAction(HdmiCecMessage message) { assertRunOnServiceThread(); - for (HdmiCecFeatureAction action : mActions) { - if (action.processCommand(message)) { - return true; - } + boolean processed = false; + // Use copied action list in that processCommand may remove itself. + for (HdmiCecFeatureAction action : new ArrayList<>(mActions)) { + // Iterates all actions to check whether incoming message is consumed. + boolean result = action.processCommand(message); + processed = processed || result; } - return false; + return processed; } @ServiceThreadOnly @@ -425,9 +426,7 @@ abstract class HdmiCecLocalDevice { final long downTime = SystemClock.uptimeMillis(); final byte[] params = message.getParams(); - // Note that we don't support parameterized keycode now. - // TODO: translate parameterized keycode as well. - final int keycode = HdmiCecKeycode.cecKeyToAndroidKey(params[0]); + final int keycode = HdmiCecKeycode.cecKeycodeAndParamsToAndroidKey(params); int keyRepeatCount = 0; if (mLastKeycode != HdmiCecKeycode.UNSUPPORTED_KEYCODE) { if (keycode == mLastKeycode) { diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java index bd9f04b..f6069bb 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java @@ -350,13 +350,26 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { if (!action.isEmpty()) { action.get(0).processKeyEvent(keyCode, isPressed); } else { - if (isPressed && getActiveSource().isValid()) { - int logicalAddress = getActiveSource().logicalAddress; - addAndStartAction(new SendKeyAction(this, logicalAddress, keyCode)); - } else { - Slog.w(TAG, "Discard key event: " + keyCode + " pressed:" + isPressed); + if (isPressed) { + int logicalAddress = findKeyReceiverAddress(); + if (logicalAddress != Constants.ADDR_INVALID) { + addAndStartAction(new SendKeyAction(this, logicalAddress, keyCode)); + return; + } } + Slog.w(TAG, "Discard key event: " + keyCode + " pressed:" + isPressed); + } + } + + private int findKeyReceiverAddress() { + if (getActiveSource().isValid()) { + return getActiveSource().logicalAddress; + } + HdmiDeviceInfo info = getDeviceInfoByPath(getActivePath()); + if (info != null) { + return info.getLogicalAddress(); } + return Constants.ADDR_INVALID; } private static void invokeCallback(IHdmiControlCallback callback, int result) { diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java index 4d9b4e9..d73f8fb 100644 --- a/services/core/java/com/android/server/hdmi/HdmiControlService.java +++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java @@ -724,20 +724,18 @@ public final class HdmiControlService extends SystemService { void onHotplug(int portId, boolean connected) { assertRunOnServiceThread(); - ArrayList<HdmiCecLocalDevice> localDevices = new ArrayList<>(); - for (int type : mLocalDevices) { - if (type == HdmiDeviceInfo.DEVICE_TV) { - // Skip the reallocation of the logical address on TV. - continue; - } - HdmiCecLocalDevice localDevice = mCecController.getLocalDevice(type); - if (localDevice == null) { - localDevice = HdmiCecLocalDevice.create(this, type); - localDevice.init(); + if (connected && !isTvDevice()) { + ArrayList<HdmiCecLocalDevice> localDevices = new ArrayList<>(); + for (int type : mLocalDevices) { + HdmiCecLocalDevice localDevice = mCecController.getLocalDevice(type); + if (localDevice == null) { + localDevice = HdmiCecLocalDevice.create(this, type); + localDevice.init(); + } + localDevices.add(localDevice); } - localDevices.add(localDevice); + allocateLogicalAddress(localDevices, INITIATED_BY_HOTPLUG); } - allocateLogicalAddress(localDevices, INITIATED_BY_HOTPLUG); for (HdmiCecLocalDevice device : mCecController.getLocalDeviceList()) { device.onHotplug(portId, connected); @@ -1691,7 +1689,7 @@ public final class HdmiControlService extends SystemService { } boolean isTvDevice() { - return tv() != null; + return mLocalDevices.contains(HdmiDeviceInfo.DEVICE_TV); } private HdmiCecLocalDevicePlayback playback() { diff --git a/services/core/java/com/android/server/hdmi/OneTouchPlayAction.java b/services/core/java/com/android/server/hdmi/OneTouchPlayAction.java index 7db991a..e764a1c 100644 --- a/services/core/java/com/android/server/hdmi/OneTouchPlayAction.java +++ b/services/core/java/com/android/server/hdmi/OneTouchPlayAction.java @@ -92,7 +92,8 @@ final class OneTouchPlayAction extends HdmiCecFeatureAction { @Override boolean processCommand(HdmiCecMessage cmd) { - if (mState != STATE_WAITING_FOR_REPORT_POWER_STATUS) { + if (mState != STATE_WAITING_FOR_REPORT_POWER_STATUS + || mTargetAddress != cmd.getSource()) { return false; } if (cmd.getOpcode() == Constants.MESSAGE_REPORT_POWER_STATUS) { diff --git a/services/core/java/com/android/server/hdmi/OneTouchRecordAction.java b/services/core/java/com/android/server/hdmi/OneTouchRecordAction.java index 39c0d7f..906944b 100644 --- a/services/core/java/com/android/server/hdmi/OneTouchRecordAction.java +++ b/services/core/java/com/android/server/hdmi/OneTouchRecordAction.java @@ -68,23 +68,21 @@ public class OneTouchRecordAction extends HdmiCecFeatureAction { finish(); return; } - - mState = STATE_WAITING_FOR_RECORD_STATUS; - addTimer(mState, RECORD_STATUS_TIMEOUT_MS); } }); + mState = STATE_WAITING_FOR_RECORD_STATUS; + addTimer(mState, RECORD_STATUS_TIMEOUT_MS); } @Override boolean processCommand(HdmiCecMessage cmd) { - if (mState != STATE_WAITING_FOR_RECORD_STATUS) { + if (mState != STATE_WAITING_FOR_RECORD_STATUS || mRecorderAddress != cmd.getSource()) { return false; } switch (cmd.getOpcode()) { case Constants.MESSAGE_RECORD_STATUS: return handleRecordStatus(cmd); - } return false; } diff --git a/services/core/java/com/android/server/hdmi/SendKeyAction.java b/services/core/java/com/android/server/hdmi/SendKeyAction.java index ed978e0..1de695b 100644 --- a/services/core/java/com/android/server/hdmi/SendKeyAction.java +++ b/services/core/java/com/android/server/hdmi/SendKeyAction.java @@ -109,12 +109,12 @@ final class SendKeyAction extends HdmiCecFeatureAction { } private void sendKeyDown(int keycode) { - int cecKeycode = HdmiCecKeycode.androidKeyToCecKey(keycode); - if (cecKeycode == HdmiCecKeycode.UNSUPPORTED_KEYCODE) { + byte[] cecKeycodeAndParams = HdmiCecKeycode.androidKeyToCecKey(keycode); + if (cecKeycodeAndParams == null) { return; } sendCommand(HdmiCecMessageBuilder.buildUserControlPressed(getSourceAddress(), - mTargetAddress, new byte[] { (byte) (cecKeycode & 0xFF) })); + mTargetAddress, cecKeycodeAndParams)); } private void sendKeyUp() { diff --git a/services/core/java/com/android/server/hdmi/SystemAudioAction.java b/services/core/java/com/android/server/hdmi/SystemAudioAction.java index 0871194..6023354 100644 --- a/services/core/java/com/android/server/hdmi/SystemAudioAction.java +++ b/services/core/java/com/android/server/hdmi/SystemAudioAction.java @@ -125,6 +125,9 @@ abstract class SystemAudioAction extends HdmiCecFeatureAction { @Override final boolean processCommand(HdmiCecMessage cmd) { + if (cmd.getSource() != mAvrLogicalAddress) { + return false; + } switch (mState) { case STATE_WAIT_FOR_SET_SYSTEM_AUDIO_MODE: if (cmd.getOpcode() == Constants.MESSAGE_FEATURE_ABORT diff --git a/services/core/java/com/android/server/hdmi/SystemAudioAutoInitiationAction.java b/services/core/java/com/android/server/hdmi/SystemAudioAutoInitiationAction.java index 3653aac..50f8475 100644 --- a/services/core/java/com/android/server/hdmi/SystemAudioAutoInitiationAction.java +++ b/services/core/java/com/android/server/hdmi/SystemAudioAutoInitiationAction.java @@ -58,17 +58,16 @@ final class SystemAudioAutoInitiationAction extends HdmiCecFeatureAction { @Override boolean processCommand(HdmiCecMessage cmd) { - if (mState != STATE_WAITING_FOR_SYSTEM_AUDIO_MODE_STATUS) { + if (mState != STATE_WAITING_FOR_SYSTEM_AUDIO_MODE_STATUS + || mAvrAddress != cmd.getSource()) { return false; } - switch (cmd.getOpcode()) { - case Constants.MESSAGE_SYSTEM_AUDIO_MODE_STATUS: - handleSystemAudioModeStatusMessage(); - return true; - default: - return false; + if (cmd.getOpcode() == Constants.MESSAGE_SYSTEM_AUDIO_MODE_STATUS) { + handleSystemAudioModeStatusMessage(); + return true; } + return false; } private void handleSystemAudioModeStatusMessage() { diff --git a/services/core/java/com/android/server/hdmi/SystemAudioStatusAction.java b/services/core/java/com/android/server/hdmi/SystemAudioStatusAction.java index bfcda50..dba3591 100644 --- a/services/core/java/com/android/server/hdmi/SystemAudioStatusAction.java +++ b/services/core/java/com/android/server/hdmi/SystemAudioStatusAction.java @@ -79,7 +79,7 @@ final class SystemAudioStatusAction extends HdmiCecFeatureAction { @Override boolean processCommand(HdmiCecMessage cmd) { - if (mState != STATE_WAIT_FOR_REPORT_AUDIO_STATUS) { + if (mState != STATE_WAIT_FOR_REPORT_AUDIO_STATUS || mAvrAddress != cmd.getSource()) { return false; } diff --git a/services/core/java/com/android/server/hdmi/TimerRecordingAction.java b/services/core/java/com/android/server/hdmi/TimerRecordingAction.java index 8fc0182..5fcbc91 100644 --- a/services/core/java/com/android/server/hdmi/TimerRecordingAction.java +++ b/services/core/java/com/android/server/hdmi/TimerRecordingAction.java @@ -96,11 +96,8 @@ public class TimerRecordingAction extends HdmiCecFeatureAction { @Override boolean processCommand(HdmiCecMessage cmd) { - if (mState != STATE_WAITING_FOR_TIMER_STATUS) { - return false; - } - - if (cmd.getSource() != mRecorderAddress) { + if (mState != STATE_WAITING_FOR_TIMER_STATUS + || cmd.getSource() != mRecorderAddress) { return false; } diff --git a/services/core/java/com/android/server/hdmi/VolumeControlAction.java b/services/core/java/com/android/server/hdmi/VolumeControlAction.java index 4338fc7..f1a9a5c 100644 --- a/services/core/java/com/android/server/hdmi/VolumeControlAction.java +++ b/services/core/java/com/android/server/hdmi/VolumeControlAction.java @@ -45,6 +45,7 @@ final class VolumeControlAction extends HdmiCecFeatureAction { private boolean mIsVolumeUp; private long mLastKeyUpdateTime; private int mLastAvrVolume; + private boolean mLastAvrMute; private boolean mSentKeyPressed; /** @@ -74,6 +75,7 @@ final class VolumeControlAction extends HdmiCecFeatureAction { mAvrAddress = avrAddress; mIsVolumeUp = isVolumeUp; mLastAvrVolume = UNKNOWN_AVR_VOLUME; + mLastAvrMute = false; mSentKeyPressed = false; updateLastKeyUpdateTime(); @@ -108,6 +110,8 @@ final class VolumeControlAction extends HdmiCecFeatureAction { HdmiLogger.debug("Volume Key Status Changed[old:%b new:%b]", mIsVolumeUp, isVolumeUp); sendVolumeKeyReleased(); mIsVolumeUp = isVolumeUp; + sendVolumeKeyPressed(); + resetTimer(); } updateLastKeyUpdateTime(); } @@ -129,9 +133,8 @@ final class VolumeControlAction extends HdmiCecFeatureAction { return handleReportAudioStatus(cmd); case MESSAGE_FEATURE_ABORT: return handleFeatureAbort(cmd); - default: - return false; } + return false; } private boolean handleReportAudioStatus(HdmiCecMessage cmd) { @@ -139,9 +142,12 @@ final class VolumeControlAction extends HdmiCecFeatureAction { boolean mute = (params[0] & 0x80) == 0x80; int volume = params[0] & 0x7F; mLastAvrVolume = volume; + mLastAvrMute = mute; if (shouldUpdateAudioVolume(mute)) { HdmiLogger.debug("Force volume change[mute:%b, volume=%d]", mute, volume); tv().setAudioStatus(mute, volume); + mLastAvrVolume = UNKNOWN_AVR_VOLUME; + mLastAvrMute = false; } return true; } @@ -182,8 +188,9 @@ final class VolumeControlAction extends HdmiCecFeatureAction { sendVolumeKeyReleased(); } if (mLastAvrVolume != UNKNOWN_AVR_VOLUME) { - tv().setAudioStatus(false, mLastAvrVolume); + tv().setAudioStatus(mLastAvrMute, mLastAvrVolume); mLastAvrVolume = UNKNOWN_AVR_VOLUME; + mLastAvrMute = false; } } diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 2d6c2ee..6224a9f 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -80,6 +80,7 @@ import org.xmlpull.v1.XmlSerializer; import android.app.ActivityManager; import android.app.ActivityManagerNative; +import android.app.AppGlobals; import android.app.IActivityManager; import android.app.admin.IDevicePolicyManager; import android.app.backup.IBackupManager; @@ -4449,62 +4450,120 @@ public class PackageManagerService extends IPackageManager.Stub { } if (pkgs != null) { - // Filter out packages that aren't recently used. - // - // The exception is first boot of a non-eng device (aka !mLazyDexOpt), which - // should do a full dexopt. - if (mLazyDexOpt || (!isFirstBoot() && mPackageUsage.isHistoricalPackageUsageAvailable())) { - // TODO: add a property to control this? - long dexOptLRUThresholdInMinutes; - if (mLazyDexOpt) { - dexOptLRUThresholdInMinutes = 30; // only last 30 minutes of apps for eng builds. - } else { - dexOptLRUThresholdInMinutes = 7 * 24 * 60; // apps used in the 7 days for users. - } - long dexOptLRUThresholdInMills = dexOptLRUThresholdInMinutes * 60 * 1000; - - int total = pkgs.size(); - int skipped = 0; - long now = System.currentTimeMillis(); - for (Iterator<PackageParser.Package> i = pkgs.iterator(); i.hasNext();) { - PackageParser.Package pkg = i.next(); - long then = pkg.mLastPackageUsageTimeInMills; - if (then + dexOptLRUThresholdInMills < now) { - if (DEBUG_DEXOPT) { - Log.i(TAG, "Skipping dexopt of " + pkg.packageName + " last resumed: " + - ((then == 0) ? "never" : new Date(then))); - } - i.remove(); - skipped++; - } + // Sort apps by importance for dexopt ordering. Important apps are given more priority + // in case the device runs out of space. + ArrayList<PackageParser.Package> sortedPkgs = new ArrayList<PackageParser.Package>(); + // Give priority to system apps that listen for pre boot complete. + Intent intent = new Intent(Intent.ACTION_PRE_BOOT_COMPLETED); + HashSet<String> pkgNames = getPackageNamesForIntent(intent); + for (Iterator<PackageParser.Package> it = pkgs.iterator(); it.hasNext();) { + PackageParser.Package pkg = it.next(); + if (pkgNames.contains(pkg.packageName)) { + sortedPkgs.add(pkg); + it.remove(); } - if (DEBUG_DEXOPT) { - Log.i(TAG, "Skipped optimizing " + skipped + " of " + total); + } + // Give priority to system apps. + for (Iterator<PackageParser.Package> it = pkgs.iterator(); it.hasNext();) { + PackageParser.Package pkg = it.next(); + if (isSystemApp(pkg)) { + sortedPkgs.add(pkg); + it.remove(); + } + } + // Give priority to apps that listen for boot complete. + intent = new Intent(Intent.ACTION_BOOT_COMPLETED); + pkgNames = getPackageNamesForIntent(intent); + for (Iterator<PackageParser.Package> it = pkgs.iterator(); it.hasNext();) { + PackageParser.Package pkg = it.next(); + if (pkgNames.contains(pkg.packageName)) { + sortedPkgs.add(pkg); + it.remove(); } } + // Filter out packages that aren't recently used. + filterRecentlyUsedApps(pkgs); + // Add all remaining apps. + for (PackageParser.Package pkg : pkgs) { + sortedPkgs.add(pkg); + } int i = 0; - for (PackageParser.Package pkg : pkgs) { - i++; - if (DEBUG_DEXOPT) { - Log.i(TAG, "Optimizing app " + i + " of " + pkgs.size() - + ": " + pkg.packageName); - } - if (!isFirstBoot()) { - try { - ActivityManagerNative.getDefault().showBootMessage( - mContext.getResources().getString( - R.string.android_upgrading_apk, - i, pkgs.size()), true); - } catch (RemoteException e) { + int total = sortedPkgs.size(); + for (PackageParser.Package pkg : sortedPkgs) { + performBootDexOpt(pkg, ++i, total); + } + } + } + + private void filterRecentlyUsedApps(HashSet<PackageParser.Package> pkgs) { + // Filter out packages that aren't recently used. + // + // The exception is first boot of a non-eng device (aka !mLazyDexOpt), which + // should do a full dexopt. + if (mLazyDexOpt || (!isFirstBoot() && mPackageUsage.isHistoricalPackageUsageAvailable())) { + // TODO: add a property to control this? + long dexOptLRUThresholdInMinutes; + if (mLazyDexOpt) { + dexOptLRUThresholdInMinutes = 30; // only last 30 minutes of apps for eng builds. + } else { + dexOptLRUThresholdInMinutes = 7 * 24 * 60; // apps used in the 7 days for users. + } + long dexOptLRUThresholdInMills = dexOptLRUThresholdInMinutes * 60 * 1000; + + int total = pkgs.size(); + int skipped = 0; + long now = System.currentTimeMillis(); + for (Iterator<PackageParser.Package> i = pkgs.iterator(); i.hasNext();) { + PackageParser.Package pkg = i.next(); + long then = pkg.mLastPackageUsageTimeInMills; + if (then + dexOptLRUThresholdInMills < now) { + if (DEBUG_DEXOPT) { + Log.i(TAG, "Skipping dexopt of " + pkg.packageName + " last resumed: " + + ((then == 0) ? "never" : new Date(then))); } - } - PackageParser.Package p = pkg; - synchronized (mInstallLock) { - performDexOptLI(p, null /* instruction sets */, false /* force dex */, false /* defer */, - true /* include dependencies */); + i.remove(); + skipped++; } } + if (DEBUG_DEXOPT) { + Log.i(TAG, "Skipped optimizing " + skipped + " of " + total); + } + } + } + + private HashSet<String> getPackageNamesForIntent(Intent intent) { + List<ResolveInfo> ris = null; + try { + ris = AppGlobals.getPackageManager().queryIntentReceivers( + intent, null, 0, UserHandle.USER_OWNER); + } catch (RemoteException e) { + } + HashSet<String> pkgNames = new HashSet<String>(); + if (ris != null) { + for (ResolveInfo ri : ris) { + pkgNames.add(ri.activityInfo.packageName); + } + } + return pkgNames; + } + + private void performBootDexOpt(PackageParser.Package pkg, int curr, int total) { + if (DEBUG_DEXOPT) { + Log.i(TAG, "Optimizing app " + curr + " of " + total + ": " + pkg.packageName); + } + if (!isFirstBoot()) { + try { + ActivityManagerNative.getDefault().showBootMessage( + mContext.getResources().getString(R.string.android_upgrading_apk, + curr, total), true); + } catch (RemoteException e) { + } + } + PackageParser.Package p = pkg; + synchronized (mInstallLock) { + performDexOptLI(p, null /* instruction sets */, false /* force dex */, + false /* defer */, true /* include dependencies */); } } diff --git a/services/core/java/com/android/server/tv/TvInputHardwareManager.java b/services/core/java/com/android/server/tv/TvInputHardwareManager.java index 77ab33b..48ac228 100644 --- a/services/core/java/com/android/server/tv/TvInputHardwareManager.java +++ b/services/core/java/com/android/server/tv/TvInputHardwareManager.java @@ -743,7 +743,7 @@ class TvInputHardwareManager implements TvInputHal.Callback { && sinkConfig.channelMask() != mDesiredChannelMask) || (mDesiredFormat != AudioFormat.ENCODING_DEFAULT && sinkConfig.format() != mDesiredFormat)) { - sinkConfig = mAudioSource.buildConfig(mDesiredSamplingRate, mDesiredChannelMask, + sinkConfig = mAudioSink.buildConfig(mDesiredSamplingRate, mDesiredChannelMask, mDesiredFormat, null); shouldRecreateAudioPatch = true; } |