Loading services/core/java/com/android/server/pm/PackageManagerService.java +56 −36 Original line number Original line Diff line number Diff line Loading @@ -383,6 +383,8 @@ public class PackageManagerService extends IPackageManager.Stub private static final boolean DEBUG_PACKAGE_SCANNING = false; private static final boolean DEBUG_PACKAGE_SCANNING = false; private static final boolean DEBUG_VERIFY = false; private static final boolean DEBUG_VERIFY = false; private static final boolean DEBUG_FILTERS = false; private static final boolean DEBUG_FILTERS = false; private static final boolean DEBUG_PERMISSIONS = false; private static final boolean DEBUG_SHARED_LIBRARIES = false; // Debug output for dexopting. This is shared between PackageManagerService, OtaDexoptService // Debug output for dexopting. This is shared between PackageManagerService, OtaDexoptService // and PackageDexOptimizer. All these classes have their own flag to allow switching a single // and PackageDexOptimizer. All these classes have their own flag to allow switching a single Loading Loading @@ -2784,10 +2786,12 @@ public class PackageManagerService extends IPackageManager.Stub // skip setup wizard; allow it to keep the high priority filter // skip setup wizard; allow it to keep the high priority filter continue; continue; } } Slog.w(TAG, "Protected action; cap priority to 0;" if (DEBUG_FILTERS) { Slog.i(TAG, "Protected action; cap priority to 0;" + " package: " + filter.activity.info.packageName + " package: " + filter.activity.info.packageName + " activity: " + filter.activity.className + " activity: " + filter.activity.className + " origPrio: " + filter.getPriority()); + " origPrio: " + filter.getPriority()); } filter.setPriority(0); filter.setPriority(0); } } } } Loading Loading @@ -9324,8 +9328,8 @@ public class PackageManagerService extends IPackageManager.Stub throw new PackageManagerException(INSTALL_FAILED_MISSING_SHARED_LIBRARY, throw new PackageManagerException(INSTALL_FAILED_MISSING_SHARED_LIBRARY, "Package " + packageName + " requires unavailable shared library " "Package " + packageName + " requires unavailable shared library " + libName + "; failing!"); + libName + "; failing!"); } else { } else if (DEBUG_SHARED_LIBRARIES) { Slog.w(TAG, "Package " + packageName Slog.i(TAG, "Package " + packageName + " desires unavailable shared library " + " desires unavailable shared library " + libName + "; ignoring!"); + libName + "; ignoring!"); } } Loading Loading @@ -10688,13 +10692,13 @@ public class PackageManagerService extends IPackageManager.Stub // Now that permission groups have a special meaning, we ignore permission // Now that permission groups have a special meaning, we ignore permission // groups for legacy apps to prevent unexpected behavior. In particular, // groups for legacy apps to prevent unexpected behavior. In particular, // permissions for one app being granted to someone just becase they happen // permissions for one app being granted to someone just because they happen // to be in a group defined by another app (before this had no implications). // to be in a group defined by another app (before this had no implications). if (pkg.applicationInfo.targetSdkVersion > Build.VERSION_CODES.LOLLIPOP_MR1) { if (pkg.applicationInfo.targetSdkVersion > Build.VERSION_CODES.LOLLIPOP_MR1) { p.group = mPermissionGroups.get(p.info.group); p.group = mPermissionGroups.get(p.info.group); // Warn for a permission in an unknown group. // Warn for a permission in an unknown group. if (p.info.group != null && p.group == null) { if (DEBUG_PERMISSIONS && p.info.group != null && p.group == null) { Slog.w(TAG, "Permission " + p.info.name + " from package " Slog.i(TAG, "Permission " + p.info.name + " from package " + p.info.packageName + " in an unknown group " + p.info.group); + p.info.packageName + " in an unknown group " + p.info.group); } } } } Loading Loading @@ -11047,12 +11051,14 @@ public class PackageManagerService extends IPackageManager.Stub if (ps.pkg != null && ps.pkg.applicationInfo != null && if (ps.pkg != null && ps.pkg.applicationInfo != null && !TextUtils.equals(adjustedAbi, ps.pkg.applicationInfo.primaryCpuAbi)) { !TextUtils.equals(adjustedAbi, ps.pkg.applicationInfo.primaryCpuAbi)) { ps.pkg.applicationInfo.primaryCpuAbi = adjustedAbi; ps.pkg.applicationInfo.primaryCpuAbi = adjustedAbi; if (DEBUG_ABI_SELECTION) { Slog.i(TAG, "Adjusting ABI for " + ps.name + " to " + adjustedAbi Slog.i(TAG, "Adjusting ABI for " + ps.name + " to " + adjustedAbi + " (requirer=" + " (requirer=" + (requirer != null ? requirer.pkg : "null") + (requirer != null ? requirer.pkg : "null") + ", scannedPackage=" + ", scannedPackage=" + (scannedPackage != null ? scannedPackage : "null") + (scannedPackage != null ? scannedPackage : "null") + ")"); + ")"); } try { try { mInstaller.rmdex(ps.codePathString, mInstaller.rmdex(ps.codePathString, getDexCodeInstructionSet(getPreferredInstructionSet())); getDexCodeInstructionSet(getPreferredInstructionSet())); Loading Loading @@ -11773,23 +11779,29 @@ public class PackageManagerService extends IPackageManager.Stub if (bp == null || bp.packageSetting == null) { if (bp == null || bp.packageSetting == null) { if (packageOfInterest == null || packageOfInterest.equals(pkg.packageName)) { if (packageOfInterest == null || packageOfInterest.equals(pkg.packageName)) { Slog.w(TAG, "Unknown permission " + name if (DEBUG_PERMISSIONS) { Slog.i(TAG, "Unknown permission " + name + " in package " + pkg.packageName); + " in package " + pkg.packageName); } } } continue; continue; } } // Limit ephemeral apps to ephemeral allowed permissions. // Limit ephemeral apps to ephemeral allowed permissions. if (pkg.applicationInfo.isInstantApp() && !bp.isInstant()) { if (pkg.applicationInfo.isInstantApp() && !bp.isInstant()) { if (DEBUG_PERMISSIONS) { Log.i(TAG, "Denying non-ephemeral permission " + bp.name + " for package " Log.i(TAG, "Denying non-ephemeral permission " + bp.name + " for package " + pkg.packageName); + pkg.packageName); } continue; continue; } } if (bp.isRuntimeOnly() && !appSupportsRuntimePermissions) { if (bp.isRuntimeOnly() && !appSupportsRuntimePermissions) { if (DEBUG_PERMISSIONS) { Log.i(TAG, "Denying runtime-only permission " + bp.name + " for package " Log.i(TAG, "Denying runtime-only permission " + bp.name + " for package " + pkg.packageName); + pkg.packageName); } continue; continue; } } Loading Loading @@ -11847,8 +11859,8 @@ public class PackageManagerService extends IPackageManager.Stub } break; } break; } } if (DEBUG_INSTALL) { if (DEBUG_PERMISSIONS) { Log.i(TAG, "Package " + pkg.packageName + " granting " + perm); Slog.i(TAG, "Granting permission " + perm + " to package " + pkg.packageName); } } if (grant != GRANT_DENIED) { if (grant != GRANT_DENIED) { Loading Loading @@ -11994,10 +12006,12 @@ public class PackageManagerService extends IPackageManager.Stub default: { default: { if (packageOfInterest == null if (packageOfInterest == null || packageOfInterest.equals(pkg.packageName)) { || packageOfInterest.equals(pkg.packageName)) { Slog.w(TAG, "Not granting permission " + perm if (DEBUG_PERMISSIONS) { Slog.i(TAG, "Not granting permission " + perm + " to package " + pkg.packageName + " to package " + pkg.packageName + " because it was previously installed without"); + " because it was previously installed without"); } } } } break; } break; } } } else { } else { Loading @@ -12015,8 +12029,10 @@ public class PackageManagerService extends IPackageManager.Stub } else if ((bp.protectionLevel&PermissionInfo.PROTECTION_FLAG_APPOP) == 0) { } else if ((bp.protectionLevel&PermissionInfo.PROTECTION_FLAG_APPOP) == 0) { // Don't print warning for app op permissions, since it is fine for them // Don't print warning for app op permissions, since it is fine for them // not to be granted, there is a UI for the user to decide. // not to be granted, there is a UI for the user to decide. if (packageOfInterest == null || packageOfInterest.equals(pkg.packageName)) { if (DEBUG_PERMISSIONS Slog.w(TAG, "Not granting permission " + perm && (packageOfInterest == null || packageOfInterest.equals(pkg.packageName))) { Slog.i(TAG, "Not granting permission " + perm + " to package " + pkg.packageName + " to package " + pkg.packageName + " (protectionLevel=" + bp.protectionLevel + " (protectionLevel=" + bp.protectionLevel + " flags=0x" + Integer.toHexString(pkg.applicationInfo.flags) + " flags=0x" + Integer.toHexString(pkg.applicationInfo.flags) Loading Loading @@ -12385,10 +12401,12 @@ public class PackageManagerService extends IPackageManager.Stub ((applicationInfo.privateFlags & ApplicationInfo.PRIVATE_FLAG_PRIVILEGED) != 0); ((applicationInfo.privateFlags & ApplicationInfo.PRIVATE_FLAG_PRIVILEGED) != 0); if (!privilegedApp) { if (!privilegedApp) { // non-privileged applications can never define a priority >0 // non-privileged applications can never define a priority >0 Slog.w(TAG, "Non-privileged app; cap priority to 0;" if (DEBUG_FILTERS) { Slog.i(TAG, "Non-privileged app; cap priority to 0;" + " package: " + applicationInfo.packageName + " package: " + applicationInfo.packageName + " activity: " + intent.activity.className + " activity: " + intent.activity.className + " origPrio: " + intent.getPriority()); + " origPrio: " + intent.getPriority()); } intent.setPriority(0); intent.setPriority(0); return; return; } } Loading Loading @@ -12428,10 +12446,12 @@ public class PackageManagerService extends IPackageManager.Stub // setup wizard gets whatever it wants // setup wizard gets whatever it wants return; return; } } Slog.w(TAG, "Protected action; cap priority to 0;" if (DEBUG_FILTERS) { Slog.i(TAG, "Protected action; cap priority to 0;" + " package: " + intent.activity.info.packageName + " package: " + intent.activity.info.packageName + " activity: " + intent.activity.className + " activity: " + intent.activity.className + " origPrio: " + intent.getPriority()); + " origPrio: " + intent.getPriority()); } intent.setPriority(0); intent.setPriority(0); return; return; } } Loading
services/core/java/com/android/server/pm/PackageManagerService.java +56 −36 Original line number Original line Diff line number Diff line Loading @@ -383,6 +383,8 @@ public class PackageManagerService extends IPackageManager.Stub private static final boolean DEBUG_PACKAGE_SCANNING = false; private static final boolean DEBUG_PACKAGE_SCANNING = false; private static final boolean DEBUG_VERIFY = false; private static final boolean DEBUG_VERIFY = false; private static final boolean DEBUG_FILTERS = false; private static final boolean DEBUG_FILTERS = false; private static final boolean DEBUG_PERMISSIONS = false; private static final boolean DEBUG_SHARED_LIBRARIES = false; // Debug output for dexopting. This is shared between PackageManagerService, OtaDexoptService // Debug output for dexopting. This is shared between PackageManagerService, OtaDexoptService // and PackageDexOptimizer. All these classes have their own flag to allow switching a single // and PackageDexOptimizer. All these classes have their own flag to allow switching a single Loading Loading @@ -2784,10 +2786,12 @@ public class PackageManagerService extends IPackageManager.Stub // skip setup wizard; allow it to keep the high priority filter // skip setup wizard; allow it to keep the high priority filter continue; continue; } } Slog.w(TAG, "Protected action; cap priority to 0;" if (DEBUG_FILTERS) { Slog.i(TAG, "Protected action; cap priority to 0;" + " package: " + filter.activity.info.packageName + " package: " + filter.activity.info.packageName + " activity: " + filter.activity.className + " activity: " + filter.activity.className + " origPrio: " + filter.getPriority()); + " origPrio: " + filter.getPriority()); } filter.setPriority(0); filter.setPriority(0); } } } } Loading Loading @@ -9324,8 +9328,8 @@ public class PackageManagerService extends IPackageManager.Stub throw new PackageManagerException(INSTALL_FAILED_MISSING_SHARED_LIBRARY, throw new PackageManagerException(INSTALL_FAILED_MISSING_SHARED_LIBRARY, "Package " + packageName + " requires unavailable shared library " "Package " + packageName + " requires unavailable shared library " + libName + "; failing!"); + libName + "; failing!"); } else { } else if (DEBUG_SHARED_LIBRARIES) { Slog.w(TAG, "Package " + packageName Slog.i(TAG, "Package " + packageName + " desires unavailable shared library " + " desires unavailable shared library " + libName + "; ignoring!"); + libName + "; ignoring!"); } } Loading Loading @@ -10688,13 +10692,13 @@ public class PackageManagerService extends IPackageManager.Stub // Now that permission groups have a special meaning, we ignore permission // Now that permission groups have a special meaning, we ignore permission // groups for legacy apps to prevent unexpected behavior. In particular, // groups for legacy apps to prevent unexpected behavior. In particular, // permissions for one app being granted to someone just becase they happen // permissions for one app being granted to someone just because they happen // to be in a group defined by another app (before this had no implications). // to be in a group defined by another app (before this had no implications). if (pkg.applicationInfo.targetSdkVersion > Build.VERSION_CODES.LOLLIPOP_MR1) { if (pkg.applicationInfo.targetSdkVersion > Build.VERSION_CODES.LOLLIPOP_MR1) { p.group = mPermissionGroups.get(p.info.group); p.group = mPermissionGroups.get(p.info.group); // Warn for a permission in an unknown group. // Warn for a permission in an unknown group. if (p.info.group != null && p.group == null) { if (DEBUG_PERMISSIONS && p.info.group != null && p.group == null) { Slog.w(TAG, "Permission " + p.info.name + " from package " Slog.i(TAG, "Permission " + p.info.name + " from package " + p.info.packageName + " in an unknown group " + p.info.group); + p.info.packageName + " in an unknown group " + p.info.group); } } } } Loading Loading @@ -11047,12 +11051,14 @@ public class PackageManagerService extends IPackageManager.Stub if (ps.pkg != null && ps.pkg.applicationInfo != null && if (ps.pkg != null && ps.pkg.applicationInfo != null && !TextUtils.equals(adjustedAbi, ps.pkg.applicationInfo.primaryCpuAbi)) { !TextUtils.equals(adjustedAbi, ps.pkg.applicationInfo.primaryCpuAbi)) { ps.pkg.applicationInfo.primaryCpuAbi = adjustedAbi; ps.pkg.applicationInfo.primaryCpuAbi = adjustedAbi; if (DEBUG_ABI_SELECTION) { Slog.i(TAG, "Adjusting ABI for " + ps.name + " to " + adjustedAbi Slog.i(TAG, "Adjusting ABI for " + ps.name + " to " + adjustedAbi + " (requirer=" + " (requirer=" + (requirer != null ? requirer.pkg : "null") + (requirer != null ? requirer.pkg : "null") + ", scannedPackage=" + ", scannedPackage=" + (scannedPackage != null ? scannedPackage : "null") + (scannedPackage != null ? scannedPackage : "null") + ")"); + ")"); } try { try { mInstaller.rmdex(ps.codePathString, mInstaller.rmdex(ps.codePathString, getDexCodeInstructionSet(getPreferredInstructionSet())); getDexCodeInstructionSet(getPreferredInstructionSet())); Loading Loading @@ -11773,23 +11779,29 @@ public class PackageManagerService extends IPackageManager.Stub if (bp == null || bp.packageSetting == null) { if (bp == null || bp.packageSetting == null) { if (packageOfInterest == null || packageOfInterest.equals(pkg.packageName)) { if (packageOfInterest == null || packageOfInterest.equals(pkg.packageName)) { Slog.w(TAG, "Unknown permission " + name if (DEBUG_PERMISSIONS) { Slog.i(TAG, "Unknown permission " + name + " in package " + pkg.packageName); + " in package " + pkg.packageName); } } } continue; continue; } } // Limit ephemeral apps to ephemeral allowed permissions. // Limit ephemeral apps to ephemeral allowed permissions. if (pkg.applicationInfo.isInstantApp() && !bp.isInstant()) { if (pkg.applicationInfo.isInstantApp() && !bp.isInstant()) { if (DEBUG_PERMISSIONS) { Log.i(TAG, "Denying non-ephemeral permission " + bp.name + " for package " Log.i(TAG, "Denying non-ephemeral permission " + bp.name + " for package " + pkg.packageName); + pkg.packageName); } continue; continue; } } if (bp.isRuntimeOnly() && !appSupportsRuntimePermissions) { if (bp.isRuntimeOnly() && !appSupportsRuntimePermissions) { if (DEBUG_PERMISSIONS) { Log.i(TAG, "Denying runtime-only permission " + bp.name + " for package " Log.i(TAG, "Denying runtime-only permission " + bp.name + " for package " + pkg.packageName); + pkg.packageName); } continue; continue; } } Loading Loading @@ -11847,8 +11859,8 @@ public class PackageManagerService extends IPackageManager.Stub } break; } break; } } if (DEBUG_INSTALL) { if (DEBUG_PERMISSIONS) { Log.i(TAG, "Package " + pkg.packageName + " granting " + perm); Slog.i(TAG, "Granting permission " + perm + " to package " + pkg.packageName); } } if (grant != GRANT_DENIED) { if (grant != GRANT_DENIED) { Loading Loading @@ -11994,10 +12006,12 @@ public class PackageManagerService extends IPackageManager.Stub default: { default: { if (packageOfInterest == null if (packageOfInterest == null || packageOfInterest.equals(pkg.packageName)) { || packageOfInterest.equals(pkg.packageName)) { Slog.w(TAG, "Not granting permission " + perm if (DEBUG_PERMISSIONS) { Slog.i(TAG, "Not granting permission " + perm + " to package " + pkg.packageName + " to package " + pkg.packageName + " because it was previously installed without"); + " because it was previously installed without"); } } } } break; } break; } } } else { } else { Loading @@ -12015,8 +12029,10 @@ public class PackageManagerService extends IPackageManager.Stub } else if ((bp.protectionLevel&PermissionInfo.PROTECTION_FLAG_APPOP) == 0) { } else if ((bp.protectionLevel&PermissionInfo.PROTECTION_FLAG_APPOP) == 0) { // Don't print warning for app op permissions, since it is fine for them // Don't print warning for app op permissions, since it is fine for them // not to be granted, there is a UI for the user to decide. // not to be granted, there is a UI for the user to decide. if (packageOfInterest == null || packageOfInterest.equals(pkg.packageName)) { if (DEBUG_PERMISSIONS Slog.w(TAG, "Not granting permission " + perm && (packageOfInterest == null || packageOfInterest.equals(pkg.packageName))) { Slog.i(TAG, "Not granting permission " + perm + " to package " + pkg.packageName + " to package " + pkg.packageName + " (protectionLevel=" + bp.protectionLevel + " (protectionLevel=" + bp.protectionLevel + " flags=0x" + Integer.toHexString(pkg.applicationInfo.flags) + " flags=0x" + Integer.toHexString(pkg.applicationInfo.flags) Loading Loading @@ -12385,10 +12401,12 @@ public class PackageManagerService extends IPackageManager.Stub ((applicationInfo.privateFlags & ApplicationInfo.PRIVATE_FLAG_PRIVILEGED) != 0); ((applicationInfo.privateFlags & ApplicationInfo.PRIVATE_FLAG_PRIVILEGED) != 0); if (!privilegedApp) { if (!privilegedApp) { // non-privileged applications can never define a priority >0 // non-privileged applications can never define a priority >0 Slog.w(TAG, "Non-privileged app; cap priority to 0;" if (DEBUG_FILTERS) { Slog.i(TAG, "Non-privileged app; cap priority to 0;" + " package: " + applicationInfo.packageName + " package: " + applicationInfo.packageName + " activity: " + intent.activity.className + " activity: " + intent.activity.className + " origPrio: " + intent.getPriority()); + " origPrio: " + intent.getPriority()); } intent.setPriority(0); intent.setPriority(0); return; return; } } Loading Loading @@ -12428,10 +12446,12 @@ public class PackageManagerService extends IPackageManager.Stub // setup wizard gets whatever it wants // setup wizard gets whatever it wants return; return; } } Slog.w(TAG, "Protected action; cap priority to 0;" if (DEBUG_FILTERS) { Slog.i(TAG, "Protected action; cap priority to 0;" + " package: " + intent.activity.info.packageName + " package: " + intent.activity.info.packageName + " activity: " + intent.activity.className + " activity: " + intent.activity.className + " origPrio: " + intent.getPriority()); + " origPrio: " + intent.getPriority()); } intent.setPriority(0); intent.setPriority(0); return; return; } }