android1.1及以前在模拟器上调整亮度和关闭屏幕没有问题,但自从更新到了1.5版本,这个功能就有问题了,原因是模拟器的模拟机制作了相应的调整。解决方案如下:
首先,利用adb将lights.goldfish.so从sdk中拉出,因为sdk中这个功能可以正常运行,但自己从源代码编译出来的image因为缺乏这个文件就有问题了;
接着,将lights.goldfish.so拷贝至源代码某一目录下;
然后,在这个目录下编写如下makefile:
# Copyright (C) 2009 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
#
#
#
# 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.
LOCAL_PATH := $(call my-dir)
ifneq ($(TARGET_PRODUCT),sim)
# HAL module implemenation, not prelinked and stored in
# hw/..so
include $(CLEAR_VARS)
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_MODULE := lights.goldfish.so
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)
endif
最后,编译源代码。
运行模拟器,是不是发现调整亮度和关闭屏幕功能是不是又恢复正常了。
阅读(2298) | 评论(1) | 转发(0) |