1.Android 6.0 以后三方Launcher不响应Home键
关键代码片段
./services/core/java/com/android/server/policy/PhoneWindowManager.java
7970 boolean goHome() {
7971 if (!isUserSetupComplete()) {
7972 Slog.i(TAG, "Not going home because user setup is in progress.");
7973 return false;
7974 }
... ... ... ...
./services/core/java/com/android/server/policy/PhoneWindowManager.java
1848 boolean isUserSetupComplete() {
1849 boolean isSetupComplete = Settings.Secure.getIntForUser(mContext.getContentResolver(),
1850 Settings.Secure.USER_SETUP_COMPLETE, 0, UserHandle.USER_CURRENT) != 0;
1851 if (mHasFeatureLeanback) {
1852 isSetupComplete &= isTvUserSetupComplete();
1853 }
1854 return isSetupComplete;
1855 }
因此只需要更改数据库配置即可
settings put secure user_setup_complete 1
settings put secure tv_user_setup_complete 1
或代码执行
TvProvision/src/com/android/tv/provision/DefaultActivity.java
32 public class DefaultActivity extends Activity {
33
34 @Override
35 protected void onCreate(Bundle icicle) {
36 super.onCreate(icicle);
37
38 // Add a persistent setting to allow other apps to know the device has been provisioned.
39 if (!isRestrictedUser()) {
40 Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1);
41 }
42 Settings.Secure.putInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 1);
43 Settings.Secure.putInt(getContentResolver(), Settings.Secure.TV_USER_SETUP_COMPLETE, 1);
2.Android Settings dump
dumpsys settings --proto
or
settings list system/secure/global
3.Android 修改音量键风格
commit c5ee8aee9732a0f7b246a9209b616170f7ab9515
Author: lei.xiao <xiaoleigs@gmail.com>
Date: Sun Sep 29 18:07:07 2019 +0800
Modify volume seekbar style to meet customer requirements
Change-Id: I7739091f2bf568782f1fad054d22e2a1b2972785
diff --git a/packages/SystemUI/res/drawable/custom_volume_style.xml b/packages/SystemUI/res/drawable/custom_volume_style.xml
new file mode 100644
index 00000000000..ba39a027f8b
--- /dev/null
+++ b/packages/SystemUI/res/drawable/custom_volume_style.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent">
+ <item android:id="@android:id/background">
+ <shape>
+ <solid android:color="#ffffff"/>
+ <corners android:color="#000000"/>
+ </shape>
+ </item>
+
+
+ <item android:id="@android:id/progress">
+ <clip>
+ <shape>
+ <corners android:color="#000000"/>
+ <solid android:color="#66ff33" />
+ </shape>
+ </clip>
+ </item>
+</layer-list>
diff --git a/packages/SystemUI/res/layout/volume_dialog_row.xml b/packages/SystemUI/res/layout/volume_dialog_row.xml
index 6128da8627a..6e350b50d0f 100644
--- a/packages/SystemUI/res/layout/volume_dialog_row.xml
+++ b/packages/SystemUI/res/layout/volume_dialog_row.xml
@@ -52,6 +52,9 @@
android:layout_height="match_parent"
android:layoutDirection="rtl"
android:layout_gravity="center"
+ android:progressDrawable="@drawable/custom_volume_style"
+ android:thumb="@null"
+ android:duplicateParentState="true"
android:rotation="90" />
</FrameLayout>
效果图如下:
4.系统应用预授权
修改etc/default-permissions 下配置xml即可。示例可参考
device/google/crosshatch/default-permissions.xml
./services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
1309 private void grantDefaultPermissionExceptions(int userId) {
1310 mHandler.removeMessages(MSG_READ_DEFAULT_PERMISSION_EXCEPTIONS);
1311
1312 synchronized (mLock) {
1313 // mGrantExceptions is null only before the first read and then
1314 // it serves as a cache of the default grants that should be
1315 // performed for every user. If there is an entry then the app
1316 // is on the system image and supports runtime permissions.
1317 if (mGrantExceptions == null) {
1318 mGrantExceptions = readDefaultPermissionExceptionsLocked();
1319 }
1320 }
1321
1322 Set<String> permissions = null;
1323 final int exceptionCount = mGrantExceptions.size();
1324 for (int i = 0; i < exceptionCount; i++) {
1325 String packageName = mGrantExceptions.keyAt(i);
1326 PackageParser.Package pkg = getSystemPackage(packageName);
1327 List<DefaultPermissionGrant> permissionGrants = mGrantExceptions.valueAt(i);
1328 final int permissionGrantCount = permissionGrants.size();
1329 for (int j = 0; j < permissionGrantCount; j++) {
1330 DefaultPermissionGrant permissionGrant = permissionGrants.get(j);
1331 if (permissions == null) {
1332 permissions = new ArraySet<>();
1333 } else {
1334 permissions.clear();
1335 }
1336 permissions.add(permissionGrant.name);
1337 grantRuntimePermissions(pkg, permissions,
1338 permissionGrant.fixed, userId);
1339 }
1340 }
1341 }
5 build 系统添加EXCLUDE_PACKAGES
diff --git a/build/make/core/main.mk b/build/make/core/main.mk
index 1946edb78f..b26388a6a0 100644
--- a/build/make/core/main.mk
+++ b/build/make/core/main.mk
@@ -901,6 +901,7 @@ ifdef BOARD_VNDK_VERSION
product_MODULES += vndk_package
endif
# Filter out the overridden packages before doing expansion
+ product_MODULES := $(filter-out $(EXCLUDE_PACKAGES),$(product_MODULES))
product_MODULES := $(filter-out $(foreach p, $(product_MODULES), \
$(PACKAGES.$(p).OVERRIDES)), $(product_MODULES))
# Filter out executables as well
一个使用demo:
--- a/device/amlogic/franklin/franklin.mk
+++ b/device/amlogic/franklin/franklin.mk
@@ -529,3 +529,4 @@ ifeq ($(AB_OTA_UPDATER),true)
$(warning $(shell ($(AUTO_PATCH_AB) $(PRODUCT_DIR))))
endif
endif
+EXCLUDE_PACKAGES := DeskClock