gpt4 book ai didi

android - 无法在android系统应用程序中导入(导入com.android.internal.statusbar)语句

转载 作者:太空狗 更新时间:2023-10-29 14:41:27 25 4
gpt4 key购买 nike

尝试从 AOSP 中的系统 android 应用程序中删除通知栏。但是无法在我的代码中导入(导入 com.android.internal.statusbar 和导入 android.app.StatusBarManager)。

import com.android.internal.statusbar.IStatusBarService;
import android.app.StatusBarManager;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
StatusBarManager mStatusBarManager = (StatusBarManager)
getSystemService(Context.STATUS_BAR_SERVICE);
mStatusBarManager.disable(StatusBarManager.DISABLE_EXPAND);
}

Android.mk

LOCAL_PATH := $(call my-dir)


include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional

LOCAL_STATIC_JAVA_LIBRARIES := \
android-support-v7-recyclerview \
android-support-v13 \
android-support-v17-leanback \
android-support-v7-appcompat

LOCAL_SRC_FILES := $(call all-java-files-under, src) \
$(call all-java-files-under, WallpaperPicker/src) \
$(call all-proto-files-under, protos)

LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/WallpaperPicker/res \
$(LOCAL_PATH)/res \

LOCAL_PROGUARD_FLAG_FILES := proguard.flags

LOCAL_PROTOC_OPTIMIZE_TYPE := nano
LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/protos/
LOCAL_AAPT_FLAGS := \
--auto-add-overlay \
--extra-packages android.support.v7.recyclerview

LOCAL_SDK_VERSION := current
LOCAL_PACKAGE_NAME := PlayerLauncher
LOCAL_PRIVILEGED_MODULE := true

LOCAL_OVERRIDES_PACKAGES := Home Launcher2
include $(BUILD_PACKAGE)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-java-files-under, util) \
$(call all-proto-files-under, protos)

LOCAL_PROTOC_OPTIMIZE_TYPE := nano
LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/protos/

LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := launcher_protoutil_lib
LOCAL_IS_HOST_MODULE := true
LOCAL_JAR_MANIFEST := util/etc/manifest.txt

include $(BUILD_HOST_JAVA_LIBRARY)

include $(CLEAR_VARS)
LOCAL_IS_HOST_MODULE := true
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := launcher_protoutil

include $(BUILD_SYSTEM)/base_rules.mk

$(LOCAL_BUILT_MODULE): |
$(HOST_OUT_JAVA_LIBRARIES)/launcher_protoutil_lib.jar
$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/util/etc/launcher_protoutil |
$(ACP)
@echo "Copy: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-new-target)
$(hide) chmod 755 $@
INTERNAL_DALVIK_MODULES += $(LOCAL_INSTALLED_MODULE)
include $(call all-makefiles-under,$(LOCAL_PATH))

Can you please help me to what type of libraries have add to in Android.mk file. Getting error while compiling system android application AOSP SDK .

build/core/Makefile:34: 警告:忽略目标的旧命令 out/target/product/g9x/system/usr/keylayout/Generic.kl'
PRODUCT_COPY_FILES 设备/amlogic/g9x/hhs/gms/permissions/android.software.app_widgets.xml:system/etc/permissions/android.software.app_widgets.xml 被忽略。
PRODUCT_COPY_FILES 设备/amlogic/g9x/hhs/gms/permissions/android.hardware.location.xml:system/etc/permissions/android.hardware.location.xml 已忽略。
TARGET_DEVICE g9x 没有私有(private)恢复资源
用 Jack 构建:out/target/common/obj/APPS/EvoPlayerLauncher_intermediates/with-local/classes.dex
启动后台服务器 java -Dfile.encoding=UTF-8 -Xms2560m -XX:+TieredCompilation -jar out/host/linux-x86/framework/jack-launcher.jar -cp out/host/linux-x86/framework/jack. jar com.android.jack.server.JackSimpleServer
VANILLA/vendor/amlogic/apps/PlayerLauncher/src/com/android/playerlauncher/MainActivity.java:5: 无法解析导入 com.android.internal.statusbar
VANILLA/vendor/amlogic/apps/PlayerLauncher/src/com/android/playerlauncher/MainActivity.java:6: 无法解析导入 android.app.StatusBarManager
VANILLA/vendor/amlogic/apps/PlayerLauncher/src/com/android/playerlauncher/MainActivity.java:45: StatusBarManager 无法解析为类型
VANILLA/vendor/amlogic/apps/PlayerLauncher/src/com/android/playerlauncher/MainActivity.java:45: StatusBarManager 无法解析为类型
VANILLA/vendor/amlogic/apps/PlayerLauncher/src/com/android/playerlauncher/MainActivity.java:45: STATUS_BAR_SERVICE 无法解析或不是字段
VANILLA/vendor/amlogic/apps/PlayerLauncher/src/com/android/playerlauncher/MainActivity.java:46: StatusBarManager 无法解析为变量
make: *** [out/target/common/obj/APPS/PlayerLauncher_intermediates/with-local/classes.dex] 错误 41
make: 离开目录
/media/VANILLA'

最佳答案

您的应用已获得特权(具有系统权限),但尚无权访问系统 API(例如 android.app.StatusBarManager)。为了获得访问权限,您需要使用平台证书对您的应用进行签名。

将此添加到您的 Android.mk:

LOCAL_CERTIFICATE := platform

关于android - 无法在android系统应用程序中导入(导入com.android.internal.statusbar)语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47511866/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com