Fix Settings crash when click uninstall button
When mPackageName is null, mFinish is true. OnResume() doesn't
invoke refreshUI(). It causes uninstall button is still enabled.
The solution is hiding AppButtonsPreference when mFinish is true.
Fixes: 138524326
Test: make RunSettingsRoboTests ROBOTEST_FILTER
Change-Id: I9759e53f002afbd4c88d8d536df3bf01c343135e
(cherry picked from commit 88228c3399
)
This commit is contained in:
@@ -160,7 +160,7 @@ public class AppButtonsPreferenceController extends BasePreferenceController imp
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
// TODO(b/37313605): Re-enable once this controller supports instant apps
|
||||
return isInstantApp() || isSystemModule() ? DISABLED_FOR_USER : AVAILABLE;
|
||||
return mFinishing || isInstantApp() || isSystemModule() ? DISABLED_FOR_USER : AVAILABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -189,7 +189,7 @@ public class AppButtonsPreferenceController extends BasePreferenceController imp
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
if (isAvailable() && !mFinishing) {
|
||||
if (isAvailable()) {
|
||||
mAppsControlDisallowedBySystem = RestrictedLockUtilsInternal.hasBaseUserRestriction(
|
||||
mActivity, UserManager.DISALLOW_APPS_CONTROL, mUserId);
|
||||
mAppsControlDisallowedAdmin = RestrictedLockUtilsInternal.checkIfRestrictionEnforced(
|
||||
|
Reference in New Issue
Block a user