summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJungshik Jang <jayjang@google.com>2014-08-25 02:08:51 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-08-25 02:08:52 +0000
commitac0d62a1181bde3724f9a794cc4a96b2a4a90587 (patch)
treec673b407df1246af013fa2ebc405c2ed11e60ef2
parentb1e066bc27dc3ab7a619855336490c67994cb8a2 (diff)
parentf67113f7abd536cc3eb888344bf925762aa5278e (diff)
downloadframeworks_base-ac0d62a1181bde3724f9a794cc4a96b2a4a90587.zip
frameworks_base-ac0d62a1181bde3724f9a794cc4a96b2a4a90587.tar.gz
frameworks_base-ac0d62a1181bde3724f9a794cc4a96b2a4a90587.tar.bz2
Merge "Use common language code in hdmi service." into lmp-dev
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java5
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiControlService.java22
2 files changed, 20 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
index 4e8c46f..935714c 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
@@ -327,7 +327,9 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
addAndStartAction(new RoutingControlAction(this, newPath, true, callback));
}
+ @ServiceThreadOnly
int getPowerStatus() {
+ assertRunOnServiceThread();
return mService.getPowerStatus();
}
@@ -428,8 +430,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
@ServiceThreadOnly
protected boolean handleGetMenuLanguage(HdmiCecMessage message) {
assertRunOnServiceThread();
- // TODO: figure out how to handle failed to get language code.
- if (!broadcastMenuLanguage(Locale.getDefault().getISO3Language())) {
+ if (!broadcastMenuLanguage(mService.getLanguage())) {
Slog.w(TAG, "Failed to respond to <Get Menu Language>: " + message.toString());
}
return true;
diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java
index 3dabc11..3021285 100644
--- a/services/core/java/com/android/server/hdmi/HdmiControlService.java
+++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java
@@ -126,8 +126,10 @@ public final class HdmiControlService extends SystemService {
}
private class HdmiControlBroadcastReceiver extends BroadcastReceiver {
+ @ServiceThreadOnly
@Override
public void onReceive(Context context, Intent intent) {
+ assertRunOnServiceThread();
switch (intent.getAction()) {
case Intent.ACTION_SCREEN_OFF:
if (isPowerOnOrTransient()) {
@@ -355,6 +357,7 @@ public final class HdmiControlService extends SystemService {
super(handler);
}
+ // onChange is set up to run in service thread.
@Override
public void onChange(boolean selfChange, Uri uri) {
String option = uri.getLastPathSegment();
@@ -1661,21 +1664,29 @@ public final class HdmiControlService extends SystemService {
}
}
+ @ServiceThreadOnly
int getPowerStatus() {
+ assertRunOnServiceThread();
return mPowerStatus;
}
+ @ServiceThreadOnly
boolean isPowerOnOrTransient() {
+ assertRunOnServiceThread();
return mPowerStatus == HdmiControlManager.POWER_STATUS_ON
|| mPowerStatus == HdmiControlManager.POWER_STATUS_TRANSIENT_TO_ON;
}
+ @ServiceThreadOnly
boolean isPowerStandbyOrTransient() {
+ assertRunOnServiceThread();
return mPowerStatus == HdmiControlManager.POWER_STATUS_STANDBY
|| mPowerStatus == HdmiControlManager.POWER_STATUS_TRANSIENT_TO_STANDBY;
}
+ @ServiceThreadOnly
boolean isPowerStandby() {
+ assertRunOnServiceThread();
return mPowerStatus == HdmiControlManager.POWER_STATUS_STANDBY;
}
@@ -1699,11 +1710,6 @@ public final class HdmiControlService extends SystemService {
// the intent, the sequence will continue at onStandby().
}
- void nap() {
- PowerManager pm = (PowerManager) getContext().getSystemService(Context.POWER_SERVICE);
- pm.nap(SystemClock.uptimeMillis());
- }
-
@ServiceThreadOnly
private void onWakeUp() {
assertRunOnServiceThread();
@@ -1753,6 +1759,12 @@ public final class HdmiControlService extends SystemService {
}
}
+ @ServiceThreadOnly
+ String getLanguage() {
+ assertRunOnServiceThread();
+ return mLanguage;
+ }
+
private void disableDevices(PendingActionClearedCallback callback) {
if (mCecController != null) {
for (HdmiCecLocalDevice device : mCecController.getLocalDeviceList()) {