Add RoleControllerManager.isApplicationVisibleForRole().
Settings doesn't actually need to know whether an application qualifies for a role, but only whether the default app setting should be visible for an application. Qualification and visibility differs in cases such as FallbackHome inside Settings which is a qualifying home activity but should never be shown in default apps UI. Fixes: 138636320 Test: manual Change-Id: I2995b6fa5c7920d14fa644748db9c41b442ce53b
This commit is contained in:
@@ -45,7 +45,7 @@ public abstract class DefaultAppShortcutPreferenceControllerBase extends BasePre
|
||||
|
||||
private boolean mRoleVisible;
|
||||
|
||||
private boolean mAppQualified;
|
||||
private boolean mAppVisible;
|
||||
|
||||
private PreferenceScreen mPreferenceScreen;
|
||||
|
||||
@@ -65,9 +65,9 @@ public abstract class DefaultAppShortcutPreferenceControllerBase extends BasePre
|
||||
mRoleVisible = visible;
|
||||
refreshAvailability();
|
||||
});
|
||||
roleControllerManager.isApplicationQualifiedForRole(mRoleName, mPackageName, executor,
|
||||
qualified -> {
|
||||
mAppQualified = qualified;
|
||||
roleControllerManager.isApplicationVisibleForRole(mRoleName, mPackageName, executor,
|
||||
visible -> {
|
||||
mAppVisible = visible;
|
||||
refreshAvailability();
|
||||
});
|
||||
}
|
||||
@@ -94,7 +94,7 @@ public abstract class DefaultAppShortcutPreferenceControllerBase extends BasePre
|
||||
if (mContext.getSystemService(UserManager.class).isManagedProfile()) {
|
||||
return DISABLED_FOR_USER;
|
||||
}
|
||||
return mRoleVisible && mAppQualified ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
return mRoleVisible && mAppVisible ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user