Hide AppButtonsPreferenceController for system modules.

Bug: 131927465
Test: atest AppButtonsPreferenceControllerTest
Change-Id: I2d3aa3429f61325afe49bfe322522fe9ccd03b2c
This commit is contained in:
Narayan Kamath
2019-05-15 18:19:44 +01:00
parent 2e26605065
commit 67d149ae37
2 changed files with 55 additions and 9 deletions

View File

@@ -160,8 +160,7 @@ public class AppButtonsPreferenceController extends BasePreferenceController imp
@Override
public int getAvailabilityStatus() {
// TODO(b/37313605): Re-enable once this controller supports instant apps
return mAppEntry != null && !AppUtils.isInstant(mAppEntry.info)
? AVAILABLE : DISABLED_FOR_USER;
return isInstantApp() || isSystemModule() ? DISABLED_FOR_USER : AVAILABLE;
}
@Override
@@ -685,6 +684,14 @@ public class AppButtonsPreferenceController extends BasePreferenceController imp
}
}
private boolean isInstantApp() {
return mAppEntry != null && AppUtils.isInstant(mAppEntry.info);
}
private boolean isSystemModule() {
return mAppEntry != null && AppUtils.isSystemModule(mContext, mAppEntry.info.packageName);
}
/**
* Changes the status of disable/enable for a package
*/