summaryrefslogtreecommitdiffstats
path: root/services/core
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2014-07-26 15:14:21 -0700
committerJeff Brown <jeffbrown@google.com>2014-07-26 15:41:21 -0700
commit0f208eb707926f0afc1ce073be866bedd4955aa2 (patch)
treecb14defbd86887db0bfc4928c2a8ac19b4b57306 /services/core
parent28c0b714ac7f6c98d63aab106447bfd1e727fae2 (diff)
downloadframeworks_base-0f208eb707926f0afc1ce073be866bedd4955aa2.zip
frameworks_base-0f208eb707926f0afc1ce073be866bedd4955aa2.tar.gz
frameworks_base-0f208eb707926f0afc1ce073be866bedd4955aa2.tar.bz2
Remove DozeHardware since it will not be used.
Bug: 16516536 Change-Id: I14597d3c9470c94e3bc5b8cff500d2fe6b2fd977
Diffstat (limited to 'services/core')
-rw-r--r--services/core/java/com/android/server/dreams/DreamManagerService.java76
-rw-r--r--services/core/java/com/android/server/dreams/McuHal.java46
-rw-r--r--services/core/jni/Android.mk1
-rw-r--r--services/core/jni/com_android_server_dreams_McuHal.cpp100
-rw-r--r--services/core/jni/onload.cpp2
5 files changed, 0 insertions, 225 deletions
diff --git a/services/core/java/com/android/server/dreams/DreamManagerService.java b/services/core/java/com/android/server/dreams/DreamManagerService.java
index 107a6f6..b894304 100644
--- a/services/core/java/com/android/server/dreams/DreamManagerService.java
+++ b/services/core/java/com/android/server/dreams/DreamManagerService.java
@@ -45,7 +45,6 @@ import android.os.UserHandle;
import android.provider.Settings;
import android.service.dreams.DreamManagerInternal;
import android.service.dreams.DreamService;
-import android.service.dreams.IDozeHardware;
import android.service.dreams.IDreamManager;
import android.text.TextUtils;
import android.util.Slog;
@@ -75,7 +74,6 @@ public final class DreamManagerService extends SystemService {
private final PowerManager mPowerManager;
private final PowerManagerInternal mPowerManagerInternal;
private final PowerManager.WakeLock mDozeWakeLock;
- private final McuHal mMcuHal; // synchronized on self
private Binder mCurrentDreamToken;
private ComponentName mCurrentDreamName;
@@ -86,7 +84,6 @@ public final class DreamManagerService extends SystemService {
private boolean mCurrentDreamIsWaking;
private int mCurrentDreamDozeScreenState = Display.STATE_UNKNOWN;
private int mCurrentDreamDozeScreenBrightness = PowerManager.BRIGHTNESS_DEFAULT;
- private DozeHardwareWrapper mCurrentDreamDozeHardware;
public DreamManagerService(Context context) {
super(context);
@@ -97,11 +94,6 @@ public final class DreamManagerService extends SystemService {
mPowerManager = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
mPowerManagerInternal = getLocalService(PowerManagerInternal.class);
mDozeWakeLock = mPowerManager.newWakeLock(PowerManager.DOZE_WAKE_LOCK, TAG);
-
- mMcuHal = McuHal.open();
- if (mMcuHal != null) {
- mMcuHal.reset();
- }
}
@Override
@@ -130,9 +122,6 @@ public final class DreamManagerService extends SystemService {
private void dumpInternal(PrintWriter pw) {
pw.println("DREAM MANAGER (dumpsys dreams)");
pw.println();
-
- pw.println("mMcuHal=" + mMcuHal);
- pw.println();
pw.println("mCurrentDreamToken=" + mCurrentDreamToken);
pw.println("mCurrentDreamName=" + mCurrentDreamName);
pw.println("mCurrentDreamUserId=" + mCurrentDreamUserId);
@@ -143,7 +132,6 @@ public final class DreamManagerService extends SystemService {
pw.println("mCurrentDreamDozeScreenState="
+ Display.stateToString(mCurrentDreamDozeScreenState));
pw.println("mCurrentDreamDozeScreenBrightness=" + mCurrentDreamDozeScreenBrightness);
- pw.println("mCurrentDreamDozeHardware=" + mCurrentDreamDozeHardware);
pw.println("getDozeComponent()=" + getDozeComponent());
pw.println();
@@ -259,17 +247,6 @@ public final class DreamManagerService extends SystemService {
}
}
- private IDozeHardware getDozeHardwareInternal(IBinder token) {
- synchronized (mLock) {
- if (mCurrentDreamToken == token && mCurrentDreamCanDoze
- && mCurrentDreamDozeHardware == null && mMcuHal != null) {
- mCurrentDreamDozeHardware = new DozeHardwareWrapper();
- return mCurrentDreamDozeHardware;
- }
- return null;
- }
- }
-
private ComponentName chooseDreamForUser(boolean doze, int userId) {
if (doze) {
ComponentName dozeComponent = getDozeComponent();
@@ -420,10 +397,6 @@ public final class DreamManagerService extends SystemService {
}
mCurrentDreamDozeScreenState = Display.STATE_UNKNOWN;
mCurrentDreamDozeScreenBrightness = PowerManager.BRIGHTNESS_DEFAULT;
- if (mCurrentDreamDozeHardware != null) {
- mCurrentDreamDozeHardware.release();
- mCurrentDreamDozeHardware = null;
- }
}
private void checkPermission(String permission) {
@@ -642,21 +615,6 @@ public final class DreamManagerService extends SystemService {
Binder.restoreCallingIdentity(ident);
}
}
-
- @Override // Binder call
- public IDozeHardware getDozeHardware(IBinder token) {
- // Requires no permission, called by Dream from an arbitrary process.
- if (token == null) {
- throw new IllegalArgumentException("token must not be null");
- }
-
- final long ident = Binder.clearCallingIdentity();
- try {
- return getDozeHardwareInternal(token);
- } finally {
- Binder.restoreCallingIdentity(ident);
- }
- }
}
private final class LocalService extends DreamManagerInternal {
@@ -676,40 +634,6 @@ public final class DreamManagerService extends SystemService {
}
}
- private final class DozeHardwareWrapper extends IDozeHardware.Stub {
- private boolean mReleased;
-
- public void release() {
- synchronized (mMcuHal) {
- if (!mReleased) {
- mReleased = true;
- mMcuHal.reset();
- }
- }
- }
-
- @Override // Binder call
- public byte[] sendMessage(String msg, byte[] arg) {
- if (msg == null) {
- throw new IllegalArgumentException("msg must not be null");
- }
-
- final long ident = Binder.clearCallingIdentity();
- try {
- synchronized (mMcuHal) {
- if (mReleased) {
- Slog.w(TAG, "Ignoring message to MCU HAL because the dream "
- + "has already ended: " + msg);
- return null;
- }
- return mMcuHal.sendMessage(msg, arg);
- }
- } finally {
- Binder.restoreCallingIdentity(ident);
- }
- }
- }
-
private final Runnable mSystemPropertiesChanged = new Runnable() {
@Override
public void run() {
diff --git a/services/core/java/com/android/server/dreams/McuHal.java b/services/core/java/com/android/server/dreams/McuHal.java
deleted file mode 100644
index 1dc79c7..0000000
--- a/services/core/java/com/android/server/dreams/McuHal.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.server.dreams;
-
-import android.service.dreams.DozeHardware;
-
-/**
- * Provides access to the low-level microcontroller hardware abstraction layer.
- */
-final class McuHal {
- private final long mPtr;
-
- private static native long nativeOpen();
- private static native byte[] nativeSendMessage(long ptr, String msg, byte[] arg);
-
- private McuHal(long ptr) {
- mPtr = ptr;
- }
-
- public static McuHal open() {
- long ptr = nativeOpen();
- return ptr != 0 ? new McuHal(ptr) : null;
- }
-
- public void reset() {
- sendMessage(DozeHardware.MSG_ENABLE_MCU, DozeHardware.VALUE_OFF);
- }
-
- public byte[] sendMessage(String msg, byte[] arg) {
- return nativeSendMessage(mPtr, msg, arg);
- }
-}
diff --git a/services/core/jni/Android.mk b/services/core/jni/Android.mk
index 5599760..9a4d900 100644
--- a/services/core/jni/Android.mk
+++ b/services/core/jni/Android.mk
@@ -10,7 +10,6 @@ LOCAL_SRC_FILES += \
$(LOCAL_REL_DIR)/com_android_server_AssetAtlasService.cpp \
$(LOCAL_REL_DIR)/com_android_server_connectivity_Vpn.cpp \
$(LOCAL_REL_DIR)/com_android_server_ConsumerIrService.cpp \
- $(LOCAL_REL_DIR)/com_android_server_dreams_McuHal.cpp \
$(LOCAL_REL_DIR)/com_android_server_hdmi_HdmiCecController.cpp \
$(LOCAL_REL_DIR)/com_android_server_hdmi_HdmiMhlController.cpp \
$(LOCAL_REL_DIR)/com_android_server_input_InputApplicationHandle.cpp \
diff --git a/services/core/jni/com_android_server_dreams_McuHal.cpp b/services/core/jni/com_android_server_dreams_McuHal.cpp
deleted file mode 100644
index a6d9297..0000000
--- a/services/core/jni/com_android_server_dreams_McuHal.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define LOG_TAG "McuHal"
-
-//#define LOG_NDEBUG 0
-
-#include "JNIHelp.h"
-#include "jni.h"
-
-#include <ScopedUtfChars.h>
-#include <ScopedPrimitiveArray.h>
-
-#include <utils/Errors.h>
-#include <utils/Log.h>
-#include <hardware/mcu.h>
-
-namespace android {
-
-static jlong nativeOpen(JNIEnv* env, jclass clazz) {
- mcu_module_t* module = NULL;
- status_t err = hw_get_module(MCU_HARDWARE_MODULE_ID,
- (hw_module_t const**)&module);
- if (err) {
- ALOGE("Couldn't load %s module (%s)", MCU_HARDWARE_MODULE_ID, strerror(-err));
- return 0;
- }
-
- err = module->init(module);
- if (err) {
- ALOGE("Couldn't initialize %s module (%s)", MCU_HARDWARE_MODULE_ID, strerror(-err));
- return 0;
- }
-
- return reinterpret_cast<jlong>(module);
-}
-
-static jbyteArray nativeSendMessage(JNIEnv* env, jclass clazz,
- jlong ptr, jstring msgStr, jbyteArray argArray) {
- mcu_module_t* module = reinterpret_cast<mcu_module_t*>(ptr);
-
- ScopedUtfChars msg(env, msgStr);
- ALOGV("Sending message %s to MCU", msg.c_str());
-
- void* result = NULL;
- size_t resultSize = 0;
- status_t err;
- if (argArray) {
- ScopedByteArrayRO arg(env, argArray);
- err = module->sendMessage(module, msg.c_str(), arg.get(), arg.size(),
- &result, &resultSize);
- } else {
- err = module->sendMessage(module, msg.c_str(), NULL, 0, &result, &resultSize);
- }
- if (err) {
- ALOGE("Couldn't send message to MCU (%s)", strerror(-err));
- return NULL;
- }
-
- if (!result) {
- return NULL;
- }
-
- jbyteArray resultArray = env->NewByteArray(resultSize);
- if (resultArray) {
- env->SetByteArrayRegion(resultArray, 0, resultSize, static_cast<jbyte*>(result));
- }
- free(result);
- return resultArray;
-}
-
-static JNINativeMethod gMcuHalMethods[] = {
- /* name, signature, funcPtr */
- { "nativeOpen", "()J",
- (void*) nativeOpen },
- { "nativeSendMessage", "(JLjava/lang/String;[B)[B",
- (void*) nativeSendMessage },
-};
-
-int register_android_server_dreams_McuHal(JNIEnv* env) {
- int res = jniRegisterNativeMethods(env, "com/android/server/dreams/McuHal",
- gMcuHalMethods, NELEM(gMcuHalMethods));
- LOG_FATAL_IF(res < 0, "Unable to register native methods.");
- return 0;
-}
-
-} /* namespace android */
diff --git a/services/core/jni/onload.cpp b/services/core/jni/onload.cpp
index bf7501e..ce2ca9b 100644
--- a/services/core/jni/onload.cpp
+++ b/services/core/jni/onload.cpp
@@ -37,7 +37,6 @@ int register_android_server_VibratorService(JNIEnv* env);
int register_android_server_location_GpsLocationProvider(JNIEnv* env);
int register_android_server_location_FlpHardwareProvider(JNIEnv* env);
int register_android_server_connectivity_Vpn(JNIEnv* env);
-int register_android_server_dreams_McuHal(JNIEnv* env);
int register_android_server_hdmi_HdmiCecController(JNIEnv* env);
int register_android_server_hdmi_HdmiMhlController(JNIEnv* env);
int register_android_server_tv_TvInputHal(JNIEnv* env);
@@ -73,7 +72,6 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved)
register_android_server_connectivity_Vpn(env);
register_android_server_AssetAtlasService(env);
register_android_server_ConsumerIrService(env);
- register_android_server_dreams_McuHal(env);
register_android_server_BatteryStatsService(env);
register_android_server_hdmi_HdmiCecController(env);
register_android_server_hdmi_HdmiMhlController(env);