在/home/wq/android_11_source_repo/packages/apps/Contacts/src/com/android/contacts/activities/ContactSelectionActivity.java
加入了一句
getWindow().addSystemFlags(android.view.WindowManager.LayoutParams
.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
编译时发现报找不到SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS的错误。?
找打定义SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS的文件:/home/wq/android_11_source_repo/frameworks/base/core/java/android/view/WindowManager.java。发现符的定义如下:
/**
* Flag to indicate that any window added by an application process that is of type
* {@link #TYPE_TOAST} or that requires
* {@link android.app.AppOpsManager#OP_SYSTEM_ALERT_WINDOW} permission should be hidden when
* this window is visible.
* @hide
*/
@SystemApi
@RequiresPermission(permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS)
public static final int SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS = 0x00080000;
发现这个api需要一个权限,在/home/wq/android_11_source_repo/packages/apps/Contacts/src/com/android/contacts/AndroidManifest.xml加入了权限,
<uses-permission android:name="android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS" />
编译依然报找不到符号的错误。
最后发现要把/home/wq/android_11_source_repo/packages/apps/Contacts/src/com/android/contacts/Android.bp的sdk_version: "current"改为sdk_version: "system_current"
--- a/Android.bp
+++ b/Android.bp
@@ -32,6 +32,6 @@ android_app {
proguard_flags_files: ["proguard.flags"],
},
- sdk_version: "current",
+ sdk_version: "system_current",
min_sdk_version: "21",
}
查了一下这两个sdk_version的区别:system_current 标志启用系统 SDK API/符号,而current 根据源树的 android 版本使用当前预构建的公共 SDK。
|