Невозможно импортировать (импортировать com.android.internal.statusbar) операторы в системное приложение Android

Попытка удалить панель уведомлений из моего системного приложения Android в AOSP. Но не могу импортировать (импортировать 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))

Не могли бы вы помочь мне с тем, какие библиотеки добавить в файл Android.mk. Получение ошибки при компиляции системного Android-приложения AOSP SDK.

build / core / Makefile: 34: предупреждение: игнорирование старых команд для target out/target/product/g9x/system/usr/keylayout/Generic.kl' PRODUCT_COPY_FILES device/amlogic/g9x/hhs/gms/permissions/android.software.app_widgets.xml:system/etc/permissions/android.software.app_widgets.xml ignored. PRODUCT_COPY_FILES device/amlogic/g9x/hhs/gms/permissions/android.hardware.location.xml:system/etc/permissions/android.hardware.location.xml ignored. No private recovery resources for TARGET_DEVICE g9x Building with Jack: out/target/common/obj/APPS/EvoPlayerLauncher_intermediates/with-local/classes.dex Launching background server 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: The import com.android.internal.statusbar cannot be resolved VANILLA/vendor/amlogic/apps/PlayerLauncher/src/com/android/playerlauncher/MainActivity.java:6: The import android.app.StatusBarManager cannot be resolved VANILLA/vendor/amlogic/apps/PlayerLauncher/src/com/android/playerlauncher/MainActivity.java:45: StatusBarManager cannot be resolved to a type VANILLA/vendor/amlogic/apps/PlayerLauncher/src/com/android/playerlauncher/MainActivity.java:45: StatusBarManager cannot be resolved to a type VANILLA/vendor/amlogic/apps/PlayerLauncher/src/com/android/playerlauncher/MainActivity.java:45: STATUS_BAR_SERVICE cannot be resolved or is not a field VANILLA/vendor/amlogic/apps/PlayerLauncher/src/com/android/playerlauncher/MainActivity.java:46: StatusBarManager cannot be resolved to a variable make: *** [out/target/common/obj/APPS/PlayerLauncher_intermediates/with-local/classes.dex] Error 41 make: Leaving directory/ СМИ / Ваниль"

1 ответ

Ваше приложение является привилегированным (имеет системные разрешения), но еще не имеет доступа к системным API (таким как android.app.StatusBarManager). Чтобы получить доступ, необходимо, чтобы ваше приложение было подписано с использованием сертификата платформы.

Добавьте это к вашему Android.mk:

LOCAL_CERTIFICATE := platform
Другие вопросы по тегам