Show correct dialog for paused profile widgets
In Android U when the profile is paused, all its packages are suspended. In this case getSuspendingPackage will return PLATFORM_PACKAGE_NAME, so by that alone it is impossible to tell whether it is admin or not. This CL changes the code so that quiet mode check takes precedence over suspension check, so that the right dialog is shown for paused profile apps. This likely changes the behaviour in rare cases when the package is suspended by admin as well, but this doesn't seem important. Bug: 277715473 Test: manual with TestDPC and Calendar Change-Id: I5e2edc28c324c0e7d95963c0b55a4b99e0af1833
This commit is contained in:
@@ -558,10 +558,14 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
|
||||
try {
|
||||
final Intent onClickIntent;
|
||||
|
||||
if (provider.maskedBySuspendedPackage) {
|
||||
if (provider.maskedByQuietProfile) {
|
||||
showBadge = true;
|
||||
onClickIntent = UnlaunchableAppActivity.createInQuietModeDialogIntent(appUserId);
|
||||
} else if (provider.maskedBySuspendedPackage) {
|
||||
showBadge = mUserManager.hasBadge(appUserId);
|
||||
final String suspendingPackage = mPackageManagerInternal.getSuspendingPackage(
|
||||
appInfo.packageName, appUserId);
|
||||
// TODO(b/281839596): don't rely on platform always meaning suspended by admin.
|
||||
if (PLATFORM_PACKAGE_NAME.equals(suspendingPackage)) {
|
||||
onClickIntent = mDevicePolicyManagerInternal.createShowAdminSupportIntent(
|
||||
appUserId, true);
|
||||
@@ -575,9 +579,6 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
|
||||
appInfo.packageName, suspendingPackage, dialogInfo, null, null,
|
||||
appUserId);
|
||||
}
|
||||
} else if (provider.maskedByQuietProfile) {
|
||||
showBadge = true;
|
||||
onClickIntent = UnlaunchableAppActivity.createInQuietModeDialogIntent(appUserId);
|
||||
} else /* provider.maskedByLockedProfile */ {
|
||||
showBadge = true;
|
||||
onClickIntent = mKeyguardManager
|
||||
|
||||
Reference in New Issue
Block a user