开发平台基本信息
芯片: QCM6125
版本: Android 13
kernel: msm-4.14
问题描述
Android6.0以上增加了运行时权限,应用要想使用例如相机、存储等权限,除了在AndroidManifest.xml
中声明,还需要在JAVA文件中进行动态申请权限。而对于我们这种智能硬件设备,客户应用几乎都是霸屏并且具有系统签名的高权限应用,这时候运行权限机制就显得有点多余;所以一般我们拿到一套新的代码,除了与支付相关或者一些认证相关,例如GMS认证等特殊设备,正常都是会默认授予应用运行时权限以及开发SELinux权限。
解决方法
--- a/QSSI.13/frameworks/base/services/core/java/com/android/server/pm/InstallPackageHelper.java
+++ b/QSSI.13/frameworks/base/services/core/java/com/android/server/pm/InstallPackageHelper.java
@@ -2174,8 +2174,10 @@ final class InstallPackageHelper {
final PermissionManagerServiceInternal.PackageInstalledParams.Builder
permissionParamsBuilder =
new PermissionManagerServiceInternal.PackageInstalledParams.Builder();
- final boolean grantPermissions = (installArgs.mInstallFlags
- & PackageManager.INSTALL_GRANT_RUNTIME_PERMISSIONS) != 0;
+ // modify by telpo for Default Authorization
+ // final boolean grantPermissions = (installArgs.installFlags
+ // & PackageManager.INSTALL_GRANT_RUNTIME_PERMISSIONS) != 0;
+ final boolean grantPermissions = true;
if (grantPermissions) {
final List<String> grantedPermissions =
installArgs.mInstallGrantPermissions != null
--- a/QSSI.13/frameworks/base/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
+++ b/QSSI.13/frameworks/base/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
@@ -452,8 +452,8 @@ final class DefaultPermissionGrantPolicy {
// Package info is already loaded, cache it
pm.addPackageInfo(pkg.packageName, pkg);
- if (!pm.isSysComponentOrPersistentPlatformSignedPrivApp(pkg)
- || !doesPackageSupportRuntimePermissions(pkg)
+ if (/*!pm.isSysComponentOrPersistentPlatformSignedPrivApp(pkg)
+ || */!doesPackageSupportRuntimePermissions(pkg)
|| ArrayUtils.isEmpty(pkg.requestedPermissions)) {
continue;
}