简体   繁体   中英

Can't import(import com.android.internal.statusbar) statements in android system application

Trying to remove notification bar from my system android application in AOSP. But can not able to import (import com.android.internal.statusbar and The import android.app.StatusBarManager) in my code.

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: warning: ignoring old commands for 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 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 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 /media/VANILLA'

Your app is privileged (has system permissions), but does not yet have access to the system APIs (such as android.app.StatusBarManager ). In order to get access, you need your app to be signed using the platform certificate.

Add this to your Android.mk :

LOCAL_CERTIFICATE := platform

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM