3

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/media/VANILLA'

  • u mean status bar like full screen app – HemalHerath Nov 28 '17 at 06:26
  • Yes...HemalHerath and i have added LOCAL_STATIC_JAVA_LIBRARIES := \ android-support-v7-recyclerview \ android-support-v13 \ android-support-v17-leanback \ android-support-v7-appcompat –  Nov 28 '17 at 06:31
  • https://developer.android.com/training/system-ui/status.html check this – HemalHerath Nov 28 '17 at 06:33
  • This link is for hiding notification bar,But I need to do completely remove notification bar and i have updated my question ,could you please check.. HemalHerath –  Nov 28 '17 at 07:12
  • https://developer.android.com/training/system-ui/immersive.html – HemalHerath Nov 28 '17 at 07:20
  • why do u want to remove that by hiding that u can do the same work as remove – HemalHerath Nov 28 '17 at 07:20
  • If will swipe down notification bar show not open.Here my problem is apk is not generating and getting error like can't import(import android.app.StatusBarManager; ) file. –  Nov 28 '17 at 07:35
  • Im sorry man I have never done what u asking, I think you should delete this question and ask the same question with brief explaination – HemalHerath Nov 28 '17 at 07:38
  • OK..Thank you..I have changed my question. –  Nov 28 '17 at 11:36
  • `com.android.internal.*` is not part of public API of android. You should use something like `reflection` in java or create a `stub` to bypass compiler . Linking process is actually happens in runtime. – ofskyMohsen Jan 24 '18 at 07:33

1 Answers1

0

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
jcady
  • 3,850
  • 2
  • 21
  • 21